如何从MinIO URI获取数据?Minikube上Kubeflow Pipeline访问问题
Kubeflow Pipeline MinIO数据访问问题解决
问题背景
在Minikube上运行Kubeflow Pipeline时,组件间传递的输出数据自动存储到了MinIO中,但未找到MinIO相关密钥,默认minioadmin账号无法登录,需要获取MinIO中的数据。Pipeline定义如下:
import kfp import kfp.components as comp from kfp.components import load_component_from_file example_component1_op = load_component_from_file("./pipelines/components/example_component1/example_component1.yaml") example_component2_op = load_component_from_file("./pipelines/components/example_component2/example_component2.yaml") @kfp.dsl.pipeline(name='example_pipeline_20220820') def example_pipeline(): example_component1_task = example_component1_op( input_1='/app/input.txt', input_2=8, ) example_component2_task = example_component2_op( input_1=example_component1_task.outputs['output_1'], input_2=5, )
相关截图
解决步骤
1. 查找MinIO密钥
Kubeflow默认将MinIO密钥存储在kubeflow命名空间下,执行以下命令查看:
kubectl get secrets -n kubeflow
通常对应的Secret名称为mlpipeline-minio-artifact。
2. 提取Access Key和Secret Key
通过以下命令解码密钥内容:
# 获取Access Key kubectl get secret mlpipeline-minio-artifact -n kubeflow -o jsonpath='{.data.accesskey}' | base64 -d # 获取Secret Key kubectl get secret mlpipeline-minio-artifact -n kubeflow -o jsonpath='{.data.secretkey}' | base64 -d
3. 访问MinIO获取数据
方式一:通过Web UI访问
- 确保已端口转发MinIO服务:
kubectl port-forward service/minio-service -n kubeflow 9000:9000
- 打开
http://localhost:9000,使用上面提取的Access Key和Secret Key登录。 - 数据默认存储在
mlpipeline桶中,路径对应Pipeline运行ID、任务ID及组件输出路径,找到对应文件即可下载。
方式二:通过MinIO客户端(mc)访问
- 安装MinIO客户端
mc,配置本地MinIO端点:
mc config host add minio-local http://localhost:9000 <提取的Access Key> <提取的Secret Key>
- 查看桶内数据结构:
mc ls minio-local/mlpipeline
- 下载指定文件到本地:
mc cp minio-local/mlpipeline/<具体文件路径> ./本地文件名
补充说明
Kubeflow Pipeline默认使用MinIO作为Artifact存储来实现组件间的数据传递,这是内置的默认配置,无需手动开启,因此数据会自动存储到MinIO中。
内容的提问来源于stack exchange,提问作者Ryo Matsuzaka
相关产品推荐
相关产品推荐




