在"在容器引擎上设置Jenkins"无法启动容器。

时间:2017-09-14 15:32:08

标签: jenkins continuous-deployment google-kubernetes-engine

我正在阅读本教程 在容器引擎上设置Jenkins https://cloud.google.com/solutions/jenkins-on-container-engine-tutorial 并且"创建Jenkins部署和服务"步骤

我一度得到了这个错误:

jenkins- 0/1 rpc错误:代码= 2 desc =无法启动容器"":来自守护程序的错误响应:{" message":" linux spec user:无法找到用户jenkins:passwd文件中没有匹配的条目"}

我得到以下命令的这些结果:

> kubectl apply -f jenkins/k8s/
deployment "jenkins" configured
service "jenkins-ui" configured
service "jenkins-discovery" configured

> get pods --namespace jenkins
NAME                       READY     STATUS             RESTARTS   AGE
jenkins-<some id>   0/1       CrashLoopBackOff   5          10m

我知道它正在寻找passwd文件中的jenkins用户,但是我仍然不确定为什么会发生这个错误以及修复它的正确方法是什么。任何见解都将受到高度赞赏。

编辑:输出&#34; kubectl get pods --namespace jenkins&#34;

第一次运行它:

> kubectl get pods --namespace jenkins
NAME                READY     STATUS              RESTARTS   AGE
jenkins-1937056428-fp7vr   0/1       ContainerCreating   0          16s

第二次运行它:

> kubectl get pods --namespace jenkins
NAME    READY     STATUS      RESTARTS   AGE                                                                                                                                 
jenkins-1937056428-fp7vr   0/1       rpc error: code = 2 desc = failed to start container "10a8ab7e3eb0ad153fd6055d86336b1cdfe9642b6993684a7e01fefbeca7a566": Error response from
 daemon: {"message":"linux spec user: unable to find user jenkins: no matching entries in passwd file"}   1          39s

第三和之后:

> kubectl get pods --namespace jenkins
NAME                       READY     STATUS             RESTARTS   AGE
jenkins-1937056428-fp7vr   0/1       CrashLoopBackOff   270        22h

2 个答案:

答案 0 :(得分:0)

似乎没有正确设置jenkins的持久磁盘卷。尝试运行以下命令以重新配置磁盘卷并重新运行jenkins pod,

kubectl delete -f jenkins/k8s/
gcloud compute disks delete jenkins-home
gcloud compute images delete jenkins-home-image
gcloud config set compute/zone us-east1-d

gcloud compute images create jenkins-home-image --source-uri https://storage.googleapis.com/solutions-public-assets/jenkins-cd/jenkins-home-v3.tar.gz
gcloud compute disks create jenkins-home --image jenkins-home-image --zone us-east1-d
kubectl apply -f jenkins/k8s/

答案 1 :(得分:0)

我基本上做错了一步:

使用Container Engine配置Kubernetes集群。

gcloud container clusters create jenkins-cd \
  --network jenkins \
  --scopes "https://www.googleapis.com/auth/projecthosting,storage-rw"

这里确保选项--network和--scopes实际上已经传入。我想我复制了命令而没有修复它并且选项被删除了。

相关问题