【问题标题】:GKE Jenkins can't download image for slaveGKE Jenkins 无法为从站下载图像
【发布时间】:2020-05-22 10:42:45
【问题描述】:

我在 GKE 上运行 Jenkins 并且在运行作业时遇到问题 - 它无法为从站下载图像 - 任何人都遇到过类似的问题 - 无论我在 GCP 上使用私有容器注册表还是官方 jenkins/jnlp-slave 图像都会发生这种情况

jenkins-agent-dz3kg                                            0/1     ErrImagePull   0          66s     x.x.x.x     gke-x-default-pool-xxxxx-x   <none>           <none>
jenkins-agent-dz3kg                                            0/1     ImagePullBackOff   0          73s    x.x.x.x     gke-x-default-pool-xxxxx-x   <none>           <none>

jenkins helm 的 values 文件非常简单

agent:
  image: "gcr.io/my-image"
  tag: "latest"
  podName: "jenkins-agent"
  TTYEnabled: true
  resources:
    requests:
      cpu: "1"
      memory: "1Gi"
    limits:
      cpu: "4"
      memory: "4Gi"

jenkins 安装了 helm 2.13.1 和上面的配置

helm install stable/jenkins --name jenkins -f jenkins.yaml

并显示图像在那里

$ gcloud container images list
NAME
gcr.io/my-project/my-image

詹金斯需要一些特殊的许可吗?

【问题讨论】:

    标签: jenkins kubernetes google-cloud-platform


    【解决方案1】:

    这是因为从站未在 GCP 中进行身份验证

    Private registries 可能需要密钥才能从中读取图像。可以通过多种方式提供凭据:

    • 每个集群
    • 在 Google Compute Engine 或 Google Kubernetes Engine 上自动配置
    • 所有 pod 都可以读取项目的私有注册表

    这两个教程应该会有所帮助

    特别是第一个教程中的第 1 步和第 2 步。

    1.在 Google Cloud 中创建一个对 GCR 具有完全访问权限的服务帐号。

    2.在 jenkins 中,使用 Google OAuth Credentials 插件为此服务帐户创建一个凭据。

    3.使用 docker-build-step 插件创建 pull/push 构建步骤,并将注册表 url 设置为 GCR。

    4.Google Container Registry Auth 插件将在执行构建步骤时将步骤 2 中创建的凭据提供给 docker。

    【讨论】:

    • 这有点用,但不是真的,它是在你部署了从站之后——联系 GCP 并从那里下载一些图像——我在 Kubernetes 上有 Jenkins——从站本身使用 Container Registry 作为它的基础镜像- 他甚至不能这样做 - 对此有什么想法吗?
    • 嗨@CptDolphin,有什么错误吗?类似,例如,there?
    • 已解决,但该死的解决方案很简单。在管理 jenkins -> 在云底部配置 -> kubernetes -> pod -> 详细信息 -> Docker Image 我必须添加项目路径 gcr。 io//:latest
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多