Failed to start container while "Setting up Jenkins on Container Engine"

9/14/2017

I'm going through this tutorial Setting up Jenkins on Container Engine https://cloud.google.com/solutions/jenkins-on-container-engine-tutorial and failing on "Creating the Jenkins deployment and services" step

I got this error at one point:

jenkins- 0/1 rpc error: code = 2 desc = failed to start container "": Error response from daemon: {"message":"linux spec user: unable to find user jenkins: no matching entries in passwd file"}

And I get these results for the following commands:

> 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

I get it that it is looking for jenkins user in the passwd file, but I'm still not sure why this error took place and what the correct way to fix it is. Any insight would be highly appreciated.


Edit: output of running "kubectl get pods --namespace jenkins"

The very first time running it:

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

Second time running it:

> 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

Third and after:

> kubectl get pods --namespace jenkins
NAME                       READY     STATUS             RESTARTS   AGE
jenkins-1937056428-fp7vr   0/1       CrashLoopBackOff   270        22h
-- foobar
continuous-deployment
google-kubernetes-engine
jenkins

2 Answers

9/21/2017

It appears that the persistent disk volume for the jenkins is not properly setup. Try running the following commands to reconfigure disk volumes and rerun 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/
-- Jayson Chacko
Source: StackOverflow

10/11/2017

I basically did one step wrong:

Provision a Kubernetes cluster using Container Engine.

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

Here make sure the options --network and --scopes actually get passed in. I guess I copied the command without fixing it up and the options got dropped.

-- foobar
Source: StackOverflow