Sonarqube recovery from failed

The volumen prefere to EBS can speed up the scanning.

Adjust the resources request and limit

1resources:
2    limits:
3        cpu: '1'
4        memory: 8Gi
5    requests:
6        cpu: 400m
7        memory: 4Gi

Change the securityContext to debug the pod and install some tools to check

1securityContext:
2        runAsUser: 0
3        runAsGroup: 0

Mount the sonar.properties to specific the java launch parameters

  • the mount and volumes
1volumes:
2    - name: sonarqube-config
3    configMap:
4        name: sonarqube-sonarqube-config
5        defaultMode: 420
6volumeMounts: 
7- name: sonarqube-config
8  mountPath: /opt/sonarqube/conf     
  • the configmap
 1apiVersion: v1
 2kind: ConfigMap
 3metadata:
 4  name: sonarqube-sonarqube-config
 5  namespace: sonarqube
 6data:
 7  sonar.properties: >-
 8    sonar.web.javaAdditionalOpts=-Xmx2G
 9
10    sonar.ce.javaAdditionalOpts=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError
11
12    sonar.search.javaAdditionalOpts=-Xmx4G -Xms4G
13    -XX:+HeapDumpOnOutOfMemoryError -Dnode.store.allow_mmap=false    

Delete the es data and relaunch the sonarqube to reindex data

1rm -rf /opt/sonarqube/data/es7
2rm -rf /opt/sonarqube/logs
3rm -rf /opt/sonarqube/temp