【问题标题】:Failed to start container while "Setting up Jenkins on Container Engine"“在容器引擎上设置 Jenkins”时无法启动容器
【发布时间】:2017-09-14 15:32:08
【问题描述】:

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

我在某一时刻遇到了这个错误:

jenkins-0/1 rpc 错误:代码 = 2 desc = 无法启动容器“”:来自守护程序的错误响应:{“消息”:“linux 规范用户:无法找到用户 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 用户,但我仍然不确定为什么会发生此错误以及修复它的正确方法是什么。任何见解将不胜感激。


编辑:运行“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 continuous-deployment google-kubernetes-engine


    【解决方案1】:

    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/
    

    【讨论】:

    • 您好杰森,感谢您的回复。我已经运行了这些命令,不幸的是得到了相同的结果。我第二次运行“kubectl get pods --namespace jenkins”命令时仍然收到此消息“无法找到用户 jenkins:passwd 文件中没有匹配的条目”。不过,您的回复非常有帮助 - 现在我知道如何进行适当的清理了。
    • 您能否发布运行“kubectl get pods --namespace jenkins”时得到的确切输出?
    【解决方案2】:

    我基本上做错了一步:

    使用 Container Engine 配置 Kubernetes 集群。

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-09-24
      • 2019-09-03
      • 2016-04-14
      • 2019-05-07
      • 2018-08-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多