gitlab kubernets 运行程序在准备阶段无法在私有 docker 注册表中进行身份验证

问题描述 投票:0回答:1

我正在我的 kubernets 集群中设置一个 gitlab runner。 跑步者已正确部署并运行。当我触发任何管道时,在准备阶段,它会失败,并从我的私有 Docker 注册表中提取身份验证错误:

Preparing the "kubernetes" executor 00:00
Using Kubernetes namespace: gitlab-runner
Using Kubernetes executor with image myprivaterepo.com/terraform:light ...
Using attach strategy to execute scripts...
Preparing environment 00:04
Waiting for pod gitlab-runner/runner-d8cjrcgf-project-2156-concurrent-0nhsjb to be running, status is Pending
    ContainersNotInitialized: "containers with incomplete status: [init-permissions]"
    ContainersNotReady: "containers with unready status: [build helper]"
    ContainersNotReady: "containers with unready status: [build helper]"
WARNING: Failed to pull image with policy "": image pull failed: rpc error: code = Unknown desc = failed to pull and unpack image "myprivaterepo.com/terraform:light": failed to resolve reference "myprivaterepo.com/terraform:light": pulling from host myprivaterepo.com failed with status code [manifests light]: 401 Unauthorized
ERROR: Job failed: prepare environment: waiting for pod running: pulling image "myprivaterepo.com/terraform:light": image pull failed: rpc error: code = Unknown desc = failed to pull and unpack image "myprivaterepo.com/terraform:light": failed to resolve reference "myprivaterepo.com/terraform:light": pulling from host myprivaterepo.com failed with status code [manifests light]: 401 Unauthorized. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information

我已经尝试添加运行程序部署 imagePullSecrets (kubernetes.io/dockerconfigjson) 以及 gitlab -> 设置 -> CI/CD -> 环境变量 -> DOCKER_AUTH_CONFIG 但这些都没有成功。

正确的添加位置在哪里?我正在使用舵图。

我的.gitlab-ci.yaml:

  .base-terraform:
    image:
      name: myprivaterepo.com/terraform:light
kubernetes gitlab-ci-runner docker-registry
1个回答
0
投票

在我的 DOCKER_AUTH_CONFIG 中,我有一个端口与实际端口不同的域。 gilab-ci 按照应有的方式自动使用了该项目环境变量。

© www.soinside.com 2019 - 2024. All rights reserved.