<p>I'm going through a tutorial on running jenkins on your kubernetes cluster. In the tutorial they're using minikube and for my existing cluster it's running on eks. When I apply my jenkins.yaml file, the pod it creates gets this error</p>
<pre><code>  Normal   Scheduled          27m                   default-scheduler  Successfully assigned default/jenkins-799666d8db-ft642 to ip-192-168-84-126.us-west-2.compute.internal
  Warning  Failed             24m (x12 over 27m)    kubelet            Error: ErrImageNeverPull
  Warning  ErrImageNeverPull  114s (x116 over 27m)  kubelet            Container image &quot;myjenkins:latest&quot; is not present with pull policy of Never
</code></pre>
<p>This was from describing the pod ^</p>
<p>Here's my jenkins.yaml file that I'm using to try to run jenkins on my cluster</p>
<pre><code>apiVersion: v1
kind: ServiceAccount
metadata:
  name: jenkins
  namespace: default
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: jenkins
  namespace: default
rules:
- apiGroups: [&quot;&quot;]
  resources: [&quot;pods&quot;,&quot;services&quot;]
  verbs: [&quot;create&quot;,&quot;delete&quot;,&quot;get&quot;,&quot;list&quot;,&quot;patch&quot;,&quot;update&quot;,&quot;watch&quot;]
- apiGroups: [&quot;apps&quot;]
  resources: [&quot;deployments&quot;]
  verbs: [&quot;create&quot;,&quot;delete&quot;,&quot;get&quot;,&quot;list&quot;,&quot;patch&quot;,&quot;update&quot;,&quot;watch&quot;]
- apiGroups: [&quot;&quot;]
  resources: [&quot;pods/exec&quot;]
  verbs: [&quot;create&quot;,&quot;delete&quot;,&quot;get&quot;,&quot;list&quot;,&quot;patch&quot;,&quot;update&quot;,&quot;watch&quot;]
- apiGroups: [&quot;&quot;]
  resources: [&quot;pods/log&quot;]
  verbs: [&quot;get&quot;,&quot;list&quot;,&quot;watch&quot;]
- apiGroups: [&quot;&quot;]
  resources: [&quot;secrets&quot;]
  verbs: [&quot;get&quot;]
- apiGroups: [&quot;&quot;]
  resources: [&quot;persistentvolumeclaims&quot;]
  verbs: [&quot;create&quot;,&quot;delete&quot;,&quot;get&quot;,&quot;list&quot;,&quot;patch&quot;,&quot;update&quot;,&quot;watch&quot;]

---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: jenkins
  namespace: default
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: jenkins
subjects:
- kind: ServiceAccount
  name: jenkins
---
# Allows jenkins to create persistent volumes
# This cluster role binding allows anyone in the &quot;manager&quot; group to read secrets in any namespace.
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: jenkins-crb
subjects:
- kind: ServiceAccount
  namespace: default
  name: jenkins
roleRef:
  kind: ClusterRole
  name: jenkinsclusterrole
  apiGroup: rbac.authorization.k8s.io
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  # &quot;namespace&quot; omitted since ClusterRoles are not namespaced
  name: jenkinsclusterrole
rules:
- apiGroups: [&quot;&quot;]
  resources: [&quot;persistentvolumes&quot;]
  verbs: [&quot;create&quot;,&quot;delete&quot;,&quot;get&quot;,&quot;list&quot;,&quot;patch&quot;,&quot;update&quot;,&quot;watch&quot;]
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: jenkins
  namespace: default
spec:
  selector:
    matchLabels:
      app: jenkins
  replicas: 1
  template:
    metadata:
      labels:
        app: jenkins
    spec:
      containers:
        - name: jenkins
          image: myjenkins:latest
          env:
            - name: JAVA_OPTS
              value: -Djenkins.install.runSetupWizard=false
          ports:
            - name: http-port
              containerPort: 8080
            - name: jnlp-port
              containerPort: 50000
          volumeMounts:
            - name: jenkins-home
              mountPath: /var/jenkins_home
            - name: docker-sock-volume
              mountPath: &quot;/var/run/docker.sock&quot;
          imagePullPolicy: Never
      volumes:
        # This allows jenkins to use the docker daemon on the host, for running builds
        # see https://stackoverflow.com/questions/27879713/is-it-ok-to-run-docker-from-inside-docker
        - name: docker-sock-volume
          hostPath:
            path: /var/run/docker.sock
        - name: jenkins-home
          hostPath:
            path: /mnt/jenkins-store
      serviceAccountName: jenkins
---
apiVersion: v1
kind: Service
metadata:
  name: jenkins
  namespace: default
spec:
  type: NodePort
  ports:
    - name: ui
      port: 8080
      targetPort: 8080
      nodePort: 31000
    - name: jnlp
      port: 50000
      targetPort: 50000
  selector:
    app: jenkins
</code></pre>
<p>Edit:</p>
<p>So far I tried removing           <code>imagePullPolicy: Never</code> and tried it again and got a different error</p>
<pre><code>Warning  Failed     17s (x2 over 32s)  kubelet            Failed to pull image &quot;myjenkins:latest&quot;: rpc error: code = Unknown desc = Error response from daemon: pull access denied for myjenkins, repository does not exist or may re
quire 'docker login': denied: requested access to the resource is denied
</code></pre>
<p>I tried running docker login and logging in and I'm still getting this same error ^. I tried changing imagePullPolicy: Never to Always and received the same error</p>
<p>After changing the image to jenkins/jenkins:lts it's still crashing and when I describe, this is what it says</p>
<pre><code>  Normal   Scheduled  4m37s                  default-scheduler  Successfully assigned default/jenkins-776574886b-x2l8p to ip-192-168-77-17.us-west-2.compute.internal
  Normal   Pulled     4m26s                  kubelet            Successfully pulled image &quot;jenkins/jenkins:lts&quot; in 11.07948886s
  Normal   Pulled     4m22s                  kubelet            Successfully pulled image &quot;jenkins/jenkins:lts&quot; in 908.246481ms
  Normal   Pulled     4m7s                   kubelet            Successfully pulled image &quot;jenkins/jenkins:lts&quot; in 885.936781ms
  Normal   Created    3m39s (x4 over 4m23s)  kubelet            Created container jenkins
  Normal   Started    3m39s (x4 over 4m23s)  kubelet            Started container jenkins
  Normal   Pulled     3m39s                  kubelet            Successfully pulled image &quot;jenkins/jenkins:lts&quot; in 895.651242ms
  Warning  BackOff    3m3s (x8 over 4m20s)   kubelet            Back-off restarting failed container
</code></pre>
<p>When I try to run &quot;kubectl logs&quot; on that pod I even get an error for that, which I've never received before when getting logs</p>
<pre><code>touch: cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied
Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?
</code></pre>
<p>Also had to change my volumemount for jenkins to this and it worked!</p>
<p>I found another resource online saying to change my jenkins volume mount to this to fix the permissions issue and my container works now
`</p>
<pre><code>volumeMounts:
        - mountPath: /var
          name: jenkins-volume
          subPath: jenkins_home`
</code></pre>

<p>As you already did, removing <code>imagePullPolicy: Never</code> would solve your first problem. Your second problem comes from the fact that you are trying to pull an image called <code>myjenkins:latest</code>, which doesn't exist. What you most likely want is <a href="https://hub.docker.com/r/jenkins/jenkins/" rel="nofollow noreferrer">this image</a>.</p>
<p>Change</p>
<pre><code>image: myjenkins:latest
</code></pre>
<p>to</p>
<pre><code>image: jenkins/jenkins:lts
</code></pre>
