I am trying to add pv to my sonarqube container, only version that works is sonarqube7.9.4-community

this is my config :

 apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: sonarqube-data
  namespace: sonar-pv
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: sonar-azurefile
  resources:
    requests:
      storage: 10Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: sonarqube-extensions
  namespace: sonar-pv
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: sonar-azurefile
  resources:
    requests:
      storage: 10Gi
---
apiVersion: v1
kind: Secret
metadata:
  name: sonarqube-secret
  namespace: sonar-pv
type: Opaque
data:
  SONARQUBE_JDBC_USERNAME: "c29uYXJxdWJl"
  SONARQUBE_JDBC_PASSWORD: "c29uYXI="
---
apiVersion: apps/v1
kind: Deployment
metadata:
    name: sonarqube-deployment
    namespace: sonar-pv
spec:
  selector:
    matchLabels:
      app: sonarqube
      tier: web
  replicas: 1
  template:
    metadata:
      name: sonarqube-deployment
      labels:
        app: sonarqube
        tier: web
    spec:
      containers:
        - name: sonarqube
          image: sonarqube
          volumeMounts:
          - mountPath: "/opt/sonarqube/data/"
            name: sonarqube-data
          - mountPath: "/opt/sonarqube/extensions/"
            name: sonarqube-extensions
          env:
          - name: SONARQUBE_JDBC_USERNAME
            valueFrom:
              secretKeyRef:
                name: sonarqube-secret
                key: SONARQUBE_JDBC_USERNAME
          - name: SONARQUBE_JDBC_PASSWORD
            valueFrom:
              secretKeyRef:
                name: sonarqube-secret
                key: SONARQUBE_JDBC_PASSWORD
          - name: "SONARQUBE_JDBC_URL"
            value: "jdbc:postgresql://postgres-service:5432/sonarqube"
          ports:
          - containerPort: 9000
            protocol: TCP
          securityContext:
            privileged: true
          resources:
            requests:
              cpu: 500m
              memory: 1024Mi
            limits:
              cpu: 2000m
              memory: 2048Mi
      initContainers:
      - name: sonarqube-init-elastic
        image: busybox
        command: ['sh', '-c', 'sysctl -w vm.max_map_count=262144']
        securityContext:
          privileged: true
      - name: permission-init-ext
        image: busybox
        command:
        - sh
        - -c
        - chown -R 999:999 /opt/sonarqube/extensions
        securityContext:
          privileged: true
        volumeMounts:
        - name: sonarqube-extensions
          mountPath: /opt/sonarqube/extensions
      - name: permission-init-data
        image: busybox
        command:
        - sh
        - -c
        - chown -R 999:999 /opt/sonarqube/data
        securityContext:
          privileged: true
        volumeMounts:
        - name: sonarqube-data
          mountPath: /opt/sonarqube/data
      volumes:
      - name: sonarqube-data
        persistentVolumeClaim:
          claimName: sonarqube-data
      - name: sonarqube-extensions
        persistentVolumeClaim:
          claimName: sonarqube-extensions

---

apiVersion: v1
kind: Service
metadata:
  name: sonarqube
  namespace: sonar-pv
  labels:
    app: sonarqube
    tier: app
spec:
  selector:
    app: sonarqube
  ports:
  - protocol: TCP
    port: 9000
    targetPort: 9000
  type: LoadBalancer

I want to have the latest version of sonarqube but they all crashes any solutions ?

Hi,

Is this about Docker? Have you tried using our official image?

 
Ann

i am deploying this on my aks cluster, yes i am using docker image of sonarqube

Hey @Oussama_Lahmar. Welcome to our community forums!

Do you have an error message or stacktrace, please?

How are you deploying it? It looks like you are crafting the resources by yourself, am I correct? Did you try our official helm charts?

I also see mentions of azurefile in your resources. We have known issues with Azure Fileshare PVC. Is that your case?

1 Like