1

我有一个带有 3 个组件的 Kubeflow 管道的 Google Cloud Platform 帐户。

我正在使用 cloudbuild 为每个组件创建 docker 映像,并将这些映像推送到容器注册表。但是,当我尝试运行管道时,Kubeflow 界面会显示以下消息:

This step is in Pending state with this message: ImagePullBackOff: Back-off pulling image "gcr.io"

随后出现此错误:

This step is in Pending state with this message: ErrImagePull: rpc error: code = Unknown desc = Error response from daemon: pull access denied for gcr.io, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

这些是运行管道的 cloudbuild 配置:

# Run Pipeline
- name: 'gcr.io/<PROJECT_ID>/kfp-util:latest'
  entrypoint: 'python3'
  args: ['pipelines/classification-pipeline/pipeline/pipeline.py',
         '--conf_file','configurations/classification_pipeline_config.yml',
         '--componentstore', 'pipelines/classification-pipeline/components',
         '--operation', 'run_pipeline']
  dir: 'implementation'
  id: 'Run Pipeline'
  waitFor: ['Create or update Pipeline']
  env:
    - 'KFP_CLIENT_HOST=${_KFP_CLIENT_HOST}'
    - 'KFP_PIPELINE_NAME=${_KFP_PIPELINE_NAME}'
    - 'PROJECT_ID=${_PROJECT_ID}'

images:
- 'gcr.io/${_PROJECT_ID}/preprocess_data:${_TAG}'
- 'gcr.io/${_PROJECT_ID}/train_model:${_TAG}'
- 'gcr.io/${_PROJECT_ID}/test_model:${_TAG}'

这是 build.py 文件:

import subprocess
import docker
import argparse
import yaml

# Get arguments
parser = argparse.ArgumentParser()
parser.add_argument("--config", help="Build Configuration Path")
args = parser.parse_args()

with open(args.config, "r") as file:
    config = yaml.load(file, Loader=yaml.FullLoader)

client = docker.from_env()
# Create the kfp-util docker container image
project = config['build']['project_id']

client.images.build(tag=str(f"gcr.io/{project}/kfp-util:latest"), path=".")
subprocess.run(f"gcloud docker -- push gcr.io/{project}/kfp-util:latest", shell=True, check=True)

# Set substitutions
substitutions = (
    f"_PROJECT_ID={project}"
)

# Submit the build job
_cmd = f"gcloud builds submit --no-source --config {config['build']['cloudbuild']} --substitutions {substitutions}"
subprocess.run(_cmd, shell=True, check=True)

知道为什么会发生此错误吗?

提前致谢!

4

1 回答 1

0

问题出在每个管道组件的 component.yaml 上指定的图像中。

而不是整个路径(gcr.io/<project_ID>/preprocess_data:<_tag>),我只有“gcr.io”。

在此更正之后,管道按预期执行。

于 2020-12-04T16:38:06.867 回答