在kubernetes插件/jenkins中从gcr中提取docker镜像的问题 [英] Problem with pulling docker images from gcr in kubernetes plugin / jenkins

查看:191
本文介绍了在kubernetes插件/jenkins中从gcr中提取docker镜像的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行着jenkins master的gke集群.我正在尝试开始构建.我正在使用由kubernetes插件(pod模板)配置的从属管道.我在gcr(私有访问权)中发布了我的jenkins奴隶的自定义图片.我已将我的gcr的凭据(Google服务帐户)添加到jenkins.但是,jenkins/kubernetes无法启动从站,因为无法从gcr提取映像.当我使用公共图像(jnlp)时,没有问题. 但是,当我尝试使用来自gcr的图片时,kubernetes会说:

I have a gke cluster with a running jenkins master. I am trying to start a build. I am using a pipeline with a slave configured by the kubernetes plugin (pod Templates). I have a custom image for my jenkins slave published in gcr (private access). I have added credentials (google service account) for my gcr to jenkins. Nevertheless jenkins/kubernetes is failing to start-up a slave because the image can't be pulled from gcr. When I use public images (jnlp) there is no issue. But when I try to use the image from gcr, kubernetes says:

Failed to pull image "eu.gcr.io/<project-id>/<image name>:<tag>": rpc error: code = Unknown desc = Error response from daemon: unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication

尽管pod在与gcr相同的项目中运行.

Although the pod is running in the same project as the gcr.

即使我使用来自gcr的图像,我也希望詹金斯能够启动奴隶.

I would expect jenkins to start the slave even if I use a image from gcr.

推荐答案

即使pod在同一项目的群集中运行,默认情况下也不会进行身份验证.

Even if the pod is running in a cluster in the same project, is not authenticated by default.

表示您已经设置了服务帐户,并且假定 Jenkins服务器中有一个附带的密钥.

Is stated that you've already set up the Service Account and I assume that there's a furnished key in the Jenkins server.

如果您使用的是 Google OAuth凭据插件,然后还可以使用 Google Container Registry Auth插件

If you're using the Google OAuth Credentials Plugin you can then also use the Google Container Registry Auth Plugin to authenticate to a private GCR repository and pull the image.

这篇关于在kubernetes插件/jenkins中从gcr中提取docker镜像的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆