<p>I want to install <a href="https://sonarqube.org" rel="nofollow noreferrer">SonarQube</a> on Kubernets with the corresponding <a href="https://github.com/helm/charts/tree/master/stable/sonarqube" rel="nofollow noreferrer">stable Helm Chart</a>. This worked on the first times. But then I noticed that LDAP doesn't work, so I modified the <code>values.yaml</code> to install plugins like mentioned in the chart: </p>

<pre><code>plugins:
  install: 
    - "https://github.com/SonarSource/sonar-ldap/releases/download/2.2-RC3/sonar-ldap-plugin-2.2.0.601.jar"
</code></pre>

<p>Since the pods doesn't get updated, I tried re-installing the chart:</p>

<pre><code>helm delete --purge sonarqube
helm install stable/sonarqube --namespace sonarqube --name sonarqube -f values.yaml
</code></pre>

<p>The problem is that now the main SonarQube related pod doesn't get created any more, as we can see in the <code>helm install</code> result:</p>

<pre><code>NAME:   sonarqube
LAST DEPLOYED: Wed Sep 25 16:04:25 2019
NAMESPACE: sonarqube2
STATUS: DEPLOYED

RESOURCES:
==&gt; v1/Secret
NAME                  TYPE    DATA  AGE
sonarqube-postgresql  Opaque  1     0s

==&gt; v1/ConfigMap
NAME                                 DATA  AGE
sonarqube-sonarqube-config           0     0s
sonarqube-sonarqube-copy-plugins     1     0s
sonarqube-sonarqube-install-plugins  1     0s
sonarqube-sonarqube-tests            1     0s

==&gt; v1/PersistentVolumeClaim
NAME                  STATUS   VOLUME      CAPACITY  ACCESS MODES  STORAGECLASS  AGE
sonarqube-postgresql  Pending  nfs-client  0s

==&gt; v1/Service
NAME                  TYPE       CLUSTER-IP    EXTERNAL-IP  PORT(S)   AGE
sonarqube-postgresql  ClusterIP  10.14.45.251  &lt;none&gt;       5432/TCP  0s
sonarqube-sonarqube   ClusterIP  10.14.38.122  &lt;none&gt;       9000/TCP  0s

==&gt; v1beta1/Deployment
NAME                  DESIRED  CURRENT  UP-TO-DATE  AVAILABLE  AGE
sonarqube-postgresql  1        1        1           0          0s
sonarqube-sonarqube   1        0        0           0          0s

==&gt; v1beta1/Ingress
NAME                 HOSTS                                  ADDRESS  PORTS  AGE
sonarqube-sonarqube  sonarqube-test.mycluster.internal  80, 443  0s

==&gt; v1/Pod(related)
NAME                                  READY  STATUS   RESTARTS  AGE
sonarqube-postgresql-b78f87cd7-ht845  0/1    Pending  0         0s


NOTES:
1. Get the application URL by running these commands:
  http://sonarqube-test.mycluster.internal
</code></pre>

<p>Also <code>kubectl get pod</code> shows just the Postgresql pod after some minutes: </p>

<pre><code>NAME                                   READY   STATUS    RESTARTS   AGE
sonarqube-postgresql-b78f87cd7-ht845   1/1     Running   0          6m
</code></pre>

<p>On the first runs, I had an additionally second pod containing SonarQube itself. As you can imagine, the application is not reachable on <code>sonarqube-test.mycluster.internal</code>, it shows <em>503 internal server error</em>. </p>

<p><strong>Why the SonarQube doesn't exist any more?</strong></p>

<p>I see no reason for this and already tried cleaning up everything multiple time, like removing the helm release, remove the entire namespace and reduce my <code>values.yaml</code> to a minium as possible. Also used just <code>helm install stable/sonarqube</code> without any <code>values.yaml</code>, the SonarQube pod is still missing. </p>

<p>All nodes are running on Kubernetes 1.11.3 so we met the criteria of having Kubernetes 1.6+ from SonarQubes requirements.</p>

<p>The <code>values.yaml</code> file: </p>

<pre><code>replicaCount: 1

service:
  type: ClusterIP
  port: 80

ingress:
  enabled: true
  hosts:
    - name: sonarqube-test.mycluster.internal
      path: /
  tls:
    - hosts:
      - sonarqube-test.mycluster.internal

persistence:
  storageClass: nfs-client
  size: 10Gi

postgresql:
  enabled: true
</code></pre>

<h3>Update: How it should look like</h3>

<p>I tried the same <code>values.yaml</code> with corresponding adjusted hostnames on our productive cluster (the problem from this question is on our test cluster) and it works as expected.</p>

<p>The relevant excerpt from <code>helm-install</code> is the second line here: </p>

<pre><code>==&gt; v1/Pod(related)
NAME                                   READY  STATUS             RESTARTS  AGE
sonarqube-postgresql-6765fd498b-gnd8w  0/1    ContainerCreating  0         0s
sonarqube-sonarqube-6c9cc8869c-45tmk   0/1    Init:0/1           0         0s
</code></pre>

<p>Differences from prod to tests are</p>

<ul>
<li>Lightly newer Kubernetes version (1.13.5 instead of 1.13.3)</li>
<li>Newer Docker version (18.9.6 instead of 1.13.1)</li>
</ul>

Daniel
<p>I had a similar problem caused by our default PSP, that restricts priviledged containers. SonarQube has a priviledged init container to set sysctl parameters required by Elasticsearch. By looking at the logs, I saw the following event:</p>

<pre><code>$ kubectl get events
LAST SEEN   FIRST SEEN   COUNT   NAME                                             KIND         SUBOBJECT   TYPE      REASON         SOURCE                  MESSAGE
8m          1h           21      sonarqube-xxx   ReplicaSet           Warning   FailedCreate   replicaset-controller      Error creating: pods "sonarqube-xxx-" is forbidden: unable to validate against any pod security policy: [spec.initContainers[0].securityContext.privileged: Invalid value: true: Privileged containers are not allowed]
</code></pre>

<p>The other environment currently doesn't have PSP enabled, since we're evaluating them. This explains why it reacts inconsistent across both clusters.Since it's a test system, I simply removed the PSP. As a long term solution, I want to pull an additional <code>values.yaml</code> parameter that disables the priviledged init container. </p>

<p>We already adjusted the sysctl parameter using Ansible on our clusters, and our goal is to have no priviledged containers for security reasons.If you're fine witth priviledged containers, you could also create a PSP for priviledged containers. Find more details in the Kubernetes docs: <a href="https://kubernetes.io/docs/concepts/policy/pod-security-policy/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/policy/pod-security-policy/</a></p>
