<pre><code>$ kubectl version

Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.6", GitCommit:"9f8ebd171479bec0ada837d7ee641dec2f8c6dd1", GitTreeState:"clean", BuildDate:"2018-03-21T15:21:50Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.6", GitCommit:"9f8ebd171479bec0ada837d7ee641dec2f8c6dd1", GitTreeState:"clean", BuildDate:"2018-03-21T15:13:31Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
</code></pre>

<p>Looking at the <a href="https://github.com/kubernetes/charts/tree/master/stable/sonarqube" rel="noreferrer">Sonarqube helm chart</a></p>

<p><strong>requirements.yaml</strong></p>

<pre><code>dependencies:
- name: sonarqube
  version: 0.5.0
  repository: https://kubernetes-charts.storage.googleapis.com/
</code></pre>

<p>Trying to install the latest version of the java plugin:</p>

<p><strong>values.yaml</strong></p>

<pre><code>plugins:
   install:
     - "http://central.maven.org/maven2/org/sonarsource/java/sonar-java-plugin/5.3.0.13828/sonar-java-plugin-5.3.0.13828.jar"
</code></pre>

<p>However, I am getting an error on the init container:</p>

<pre><code>$ kubectl logs sonarqube-sonarqube-7b5dfd84cf-sglk5 -c install-plugins

sh: /opt/sonarqube/extensions/plugins/install_plugins.sh: Permission denied
</code></pre>

<hr>

<pre><code>$ kubectl describe po sonarqube-sonarqube-7b5dfd84cf-sglk5

Name:           sonarqube-sonarqube-7b5dfd84cf-sglk5
Namespace:      default
Node:           docker-for-desktop/192.168.65.3
Start Time:     Thu, 19 Apr 2018 15:22:04 -0500
Labels:         app=sonarqube
                pod-template-hash=3618984079
                release=sonarqube
Annotations:    &lt;none&gt;
Status:         Pending
IP:             10.1.0.250
Controlled By:  ReplicaSet/sonarqube-sonarqube-7b5dfd84cf
Init Containers:
  install-plugins:
    Container ID:  docker://b090f52b95d36e03b8af86de5a6729cec8590807fe23e27689b01e5506604463
    Image:         joosthofman/wget:1.0
    Image ID:      docker-pullable://joosthofman/wget@sha256:74ef45d9683b66b158a0acaf0b0d22f3c2a6e006c3ca25edbc6cf69b6ace8294
    Port:          &lt;none&gt;
    Command:
      sh
      -c
      /opt/sonarqube/extensions/plugins/install_plugins.sh
    State:          Waiting
      Reason:       CrashLoopBackOff
</code></pre>

<p><strong>Is there a way to <code>exec</code> into the into the init container?</strong></p>

<p>My attempt:</p>

<pre><code>$ kubectl exec -it sonarqube-sonarqube-7b5dfd84cf-sglk5 -c install-plugins sh

error: unable to upgrade connection: container not found ("install-plugins")
</code></pre>

<hr>

<p><strong>Update</strong></p>

<p>With @WarrenStrange's suggestion:</p>

<pre><code>$ kubectl get pods
NAME                                    READY     STATUS    RESTARTS   AGE
sonarqube-postgresql-59975458c6-mtfjj   1/1       Running   0          11m
sonarqube-sonarqube-685bd67b8c-nmj2t    1/1       Running   0          11m

$ kubectl get pods sonarqube-sonarqube-685bd67b8c-nmj2t -o yaml
...
 initContainers:
  - command:
    - sh
    - -c
    - 'mkdir -p /opt/sonarqube/extensions/plugins/ &amp;&amp; cp /tmp/scripts/install_plugins.sh
      /opt/sonarqube/extensions/plugins/install_plugins.sh &amp;&amp; chmod 0775 /opt/sonarqube/extensions/plugins/install_plugins.sh
      &amp;&amp; /opt/sonarqube/extensions/plugins/install_plugins.sh '
    image: joosthofman/wget:1.0
    imagePullPolicy: IfNotPresent
    name: install-plugins
    resources: {}
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    volumeMounts:
    - mountPath: /opt/sonarqube/extensions
      name: sonarqube
      subPath: extensions
    - mountPath: /tmp/scripts/
      name: install-plugins
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: default-token-89d9n
      readOnly: true
...
</code></pre>

<p>Create a new pod manifest extracted from the init container manifest. Replace the command with <code>sleep 6000</code> and execute the commands. This allows you to poke around.</p>

Eric Francis
<p>The issue is that the container does not exist (see the CrashLoopBackOff).</p>

<p>One of the things that I do with init containers (assuming you have the source) is to put a sleep 600 on failure in the entrypoint. At least for debugging.  This lets you exec into the container to poke around to see the cause of the failure.</p>
