<p>I'm following the <a href="https://www.jenkins.io/doc/book/installing/kubernetes/" rel="nofollow noreferrer">doc</a> in Jenkins page, I'm running with 2 node K8s cluster (1 master 1 worker), setting service type to nodeport, for some reason the init container crashes and never comes up.</p>
<pre><code>    kubectl describe pod jenkins-0 -n jenkins
Name:         jenkins-0
Namespace:    jenkins
Priority:     0
Node:         vlab048009.dom047600.lab/10.204.110.35
Start Time:   Wed, 09 Dec 2020 23:19:59 +0530
Labels:       app.kubernetes.io/component=jenkins-controller
              app.kubernetes.io/instance=jenkins
              app.kubernetes.io/managed-by=Helm
              app.kubernetes.io/name=jenkins
              controller-revision-hash=jenkins-c5795f65f
              statefulset.kubernetes.io/pod-name=jenkins-0
Annotations:  checksum/config: 2a4c2b3ea5dea271cb7c0b8e8582b682814d39f8e933e0348725b0b9a7dbf258
Status:       Pending
IP:           10.244.1.28
IPs:
  IP:           10.244.1.28
Controlled By:  StatefulSet/jenkins
Init Containers:
  init:
    Container ID:  docker://95e3298740bcaed3c2adf832f41d346e563c92add728080cfdcfcac375e0254d
    Image:         jenkins/jenkins:lts
    Image ID:      docker-pullable://jenkins/jenkins@sha256:1433deaac433ce20c534d8b87fcd0af3f25260f375f4ee6bdb41d70e1769d9ce
    Port:          &lt;none&gt;
    Host Port:     &lt;none&gt;
    Command:
      sh
      /var/jenkins_config/apply_config.sh
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Error
      Exit Code:    1
      Started:      Wed, 09 Dec 2020 23:41:28 +0530
      Finished:     Wed, 09 Dec 2020 23:41:29 +0530
    Ready:          False
    Restart Count:  9
    Limits:
      cpu:     2
      memory:  4Gi
    Requests:
      cpu:        50m
      memory:     256Mi
    Environment:  &lt;none&gt;
    Mounts:
      /usr/share/jenkins/ref/plugins from plugins (rw)
      /var/jenkins_config from jenkins-config (rw)
      /var/jenkins_home from jenkins-home (rw)
      /var/jenkins_plugins from plugin-dir (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from jenkins-token-ppfw7 (ro)
Containers:
  jenkins:
    Container ID:
    Image:         jenkins/jenkins:lts
    Image ID:
    Ports:         8080/TCP, 50000/TCP
    Host Ports:    0/TCP, 0/TCP
    Args:
      --httpPort=8080
    State:          Waiting
      Reason:       PodInitializing
    Ready:          False
    Restart Count:  0
    Limits:
      cpu:     2
      memory:  4Gi
    Requests:
      cpu:      50m
      memory:   256Mi
    Liveness:   http-get http://:http/login delay=0s timeout=5s period=10s #success=1 #failure=5
    Readiness:  http-get http://:http/login delay=0s timeout=5s period=10s #success=1 #failure=3
    Startup:    http-get http://:http/login delay=0s timeout=5s period=10s #success=1 #failure=12
    Environment:
      POD_NAME:                  jenkins-0 (v1:metadata.name)
      JAVA_OPTS:                 -Dcasc.reload.token=$(POD_NAME)
      JENKINS_OPTS:
      JENKINS_SLAVE_AGENT_PORT:  50000
      CASC_JENKINS_CONFIG:       /var/jenkins_home/casc_configs
    Mounts:
      /run/secrets/chart-admin-password from admin-secret (ro,path=&quot;jenkins-admin-password&quot;)
      /run/secrets/chart-admin-username from admin-secret (ro,path=&quot;jenkins-admin-user&quot;)
      /usr/share/jenkins/ref/plugins/ from plugin-dir (rw)
      /var/jenkins_config from jenkins-config (ro)
      /var/jenkins_home from jenkins-home (rw)
      /var/jenkins_home/casc_configs from sc-config-volume (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from jenkins-token-ppfw7 (ro)
  config-reload:
    Container ID:
    Image:          kiwigrid/k8s-sidecar:0.1.275
    Image ID:
    Port:           &lt;none&gt;
    Host Port:      &lt;none&gt;
    State:          Waiting
      Reason:       PodInitializing
    Ready:          False
    Restart Count:  0
    Environment:
      POD_NAME:           jenkins-0 (v1:metadata.name)
      LABEL:              jenkins-jenkins-config
      FOLDER:             /var/jenkins_home/casc_configs
      NAMESPACE:          jenkins
      REQ_URL:            http://localhost:8080/reload-configuration-as-code/?casc-reload-token=$(POD_NAME)
      REQ_METHOD:         POST
      REQ_RETRY_CONNECT:  10
    Mounts:
      /var/jenkins_home from jenkins-home (rw)
      /var/jenkins_home/casc_configs from sc-config-volume (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from jenkins-token-ppfw7 (ro)
Conditions:
  Type              Status
  Initialized       False
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  plugins:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  &lt;unset&gt;
  jenkins-config:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      jenkins
    Optional:  false
  plugin-dir:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  &lt;unset&gt;
  jenkins-home:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  &lt;unset&gt;
  sc-config-volume:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  &lt;unset&gt;
  admin-secret:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  jenkins
    Optional:    false
  jenkins-token-ppfw7:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  jenkins-token-ppfw7
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  &lt;none&gt;
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason     Age                  From               Message
  ----     ------     ----                 ----               -------
  Normal   Scheduled  22m                  default-scheduler  Successfully assigned jenkins/jenkins-0 to vlab048009.dom047600.lab
  Normal   Pulled     22m                  kubelet            Successfully pulled image &quot;jenkins/jenkins:lts&quot; in 4.648858149s
  Normal   Pulled     21m                  kubelet            Successfully pulled image &quot;jenkins/jenkins:lts&quot; in 1.407161762s
  Normal   Pulled     21m                  kubelet            Successfully pulled image &quot;jenkins/jenkins:lts&quot; in 4.963056101s
  Normal   Created    21m (x4 over 22m)    kubelet            Created container init
  Normal   Started    21m (x4 over 22m)    kubelet            Started container init
  Normal   Pulled     21m                  kubelet            Successfully pulled image &quot;jenkins/jenkins:lts&quot; in 8.0749493s
  Normal   Pulling    20m (x5 over 22m)    kubelet            Pulling image &quot;jenkins/jenkins:lts&quot;
  Warning  BackOff    2m1s (x95 over 21m)  kubelet            Back-off restarting failed container
</code></pre>
<p>[</p>
<pre><code>    kubectl logs -f jenkins-0 -c init -n jenkins
    Error from server: Get &quot;https://10.204.110.35:10250/containerLogs/jenkins/jenkins-0/init?follow=true&quot;: dial tcp 10.204.110.35:10250: connect: no route to host
    
 kubectl get events -n jenkins
    LAST SEEN   TYPE      REASON             OBJECT                MESSAGE
    23m         Normal    Scheduled          pod/jenkins-0         Successfully assigned jenkins/jenkins-0 to vlab048009.dom047600.lab
    21m         Normal    Pulling            pod/jenkins-0         Pulling image &quot;jenkins/jenkins:lts&quot;
    23m         Normal    Pulled             pod/jenkins-0         Successfully pulled image &quot;jenkins/jenkins:lts&quot; in 4.648858149s
    22m         Normal    Created            pod/jenkins-0         Created container init
    22m         Normal    Started            pod/jenkins-0         Started container init
    23m         Normal    Pulled             pod/jenkins-0         Successfully pulled image &quot;jenkins/jenkins:lts&quot; in 1.407161762s
    3m30s       Warning   BackOff            pod/jenkins-0         Back-off restarting failed container
    23m         Normal    Pulled             pod/jenkins-0         Successfully pulled image &quot;jenkins/jenkins:lts&quot; in 4.963056101s
    22m         Normal    Pulled             pod/jenkins-0         Successfully pulled image &quot;jenkins/jenkins:lts&quot; in 8.0749493s
    23m         Normal    SuccessfulCreate   statefulset/jenkins   create Pod jenkins-0 in StatefulSet jenkins successful

    Every 2.0s: kubectl get all -n jenkins                                                                Wed Dec  9 23:48:31 2020
    
    NAME            READY   STATUS                  RESTARTS   AGE
    pod/jenkins-0   0/2     Init:CrashLoopBackOff   10         28m
    
    NAME                    TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
    service/jenkins         NodePort    10.103.209.122   &lt;none&gt;        8080:32323/TCP   28m
    service/jenkins-agent   ClusterIP   10.103.195.120   &lt;none&gt;        50000/TCP        28m
    
    NAME                       READY   AGE
    statefulset.apps/jenkins   0/1     28m

 
</code></pre>
<p>Using helm3 to deploy jenkins, pretty much changes done as per doc.
Not sure how to debug this issues wrt init container crashing, any leads or a solution would be appreciated, Thanks</p>

<p>Firstly make sure that you had executed command:</p>
<pre><code>$ helm repo update
</code></pre>
<p>Execute also command:</p>
<p><code>$ kubectl logs &lt;pod-name&gt; -c &lt;init-container-name&gt;</code></p>
<p>to inspect init container. Then you will be able to properly debug this setup.</p>
<p>This might be a connection issue to the Jenkins update site. You can build an image which contains required plugins and disable plugin download. Take a look: <a href="https://github.com/jenkinsci/kubernetes-plugin/blob/master/README.md" rel="nofollow noreferrer">jenkins-kubernetes</a>.</p>
<p>See more: <a href="https://github.com/jenkinsci/helm-charts/issues/185" rel="nofollow noreferrer">jenkins-helm-issues</a> - in this case problem lays in plug-in compatibility.</p>
