"Setting up Jenkins on Container Engine" 时无法启动容器
Failed to start container while "Setting up Jenkins on Container Engine"
我正在学习本教程
在容器引擎上设置 Jenkins
https://cloud.google.com/solutions/jenkins-on-container-engine-tutorial
并在 "Creating the Jenkins deployment and services" 步骤
上失败
我曾经遇到过这个错误:
jenkins- 0/1 rpc 错误:code = 2 desc = 启动容器失败“”:来自守护进程的错误响应:{"message":"linux spec user: unable to find user jenkins: no matching entries in passwd file"}
我得到以下命令的结果:
> 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 用户,但我仍然不确定为什么会发生此错误以及修复它的正确方法是什么。任何见解将不胜感激。
编辑: 运行 的输出 "kubectl get pods --namespace jenkins"
第一次运行它:
> 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
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/
我基本上错了一步:
使用容器引擎配置 Kubernetes 集群。
gcloud container clusters create jenkins-cd \
--network jenkins \
--scopes "https://www.googleapis.com/auth/projecthosting,storage-rw"
这里确保选项 --network 和 --scopes 确实被传入。我想我复制了命令但没有修复它并且选项被删除了。
我正在学习本教程 在容器引擎上设置 Jenkins https://cloud.google.com/solutions/jenkins-on-container-engine-tutorial 并在 "Creating the Jenkins deployment and services" 步骤
上失败我曾经遇到过这个错误:
jenkins- 0/1 rpc 错误:code = 2 desc = 启动容器失败“”:来自守护进程的错误响应:{"message":"linux spec user: unable to find user jenkins: no matching entries in passwd file"}
我得到以下命令的结果:
> 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 用户,但我仍然不确定为什么会发生此错误以及修复它的正确方法是什么。任何见解将不胜感激。
编辑: 运行 的输出 "kubectl get pods --namespace jenkins"
第一次运行它:
> 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
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/
我基本上错了一步:
使用容器引擎配置 Kubernetes 集群。
gcloud container clusters create jenkins-cd \
--network jenkins \
--scopes "https://www.googleapis.com/auth/projecthosting,storage-rw"
这里确保选项 --network 和 --scopes 确实被传入。我想我复制了命令但没有修复它并且选项被删除了。