Lost project configuration and users after pod restart

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube - Version 9.5 (build 56709) plugin version)

  • what are you trying to achieve
    there is no change in deployment, but pod redeployed 3 days back.
    Today i tried to login with customized credentials but i am not able to login since the default password is working.
    also i checked the configuration; the users are got deleted and i lost project configuration also.

Please help me to avoid the todo with project configuration every restart.

Hey there.

All SonarQube data is stored in the database, which means what probably happened here was that the database wasn’t preserved between pod restarts.

How is your values.yaml configured? Can you share it here?

deployed on AWS eks

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: sonarqube
  name: sonarqube
  namespace: sonarqube
spec:
  selector:
    matchLabels:
      app: sonarqube
  replicas: 1
  template:
    metadata:
      labels:
        app: sonarqube
    spec:
      containers:
        - name: sonarqube
          image: "plugin-image-uri"
          # image: sonarqube:9.4-community
          resources:
            requests:
              cpu: 500m
              memory: 1024Mi
            limits:
              cpu: 2000m
              memory: 2048Mi
          volumeMounts:
          - mountPath: "/opt/sonarqube/data/"
            name: sonar-data
          env:
          - name: "-Dsonar.jdbc.username"
            valueFrom:
               secretKeyRef:
                 name: postgres-secrets
                 key: username
          - name: "-Dsonar.jdbc.url"
            valueFrom:
              configMapKeyRef:
                name: sonar-config
                key: url
          - name: "-Dsonar.jdbc.password"
            valueFrom:
               secretKeyRef:
                 name: postgres-secrets
                 key: password
          ports:
          - containerPort: 9000
            protocol: TCP
      volumes:
      - name: sonar-data
        persistentVolumeClaim:
          claimName: sonar-data
apiVersion: apps/v1
kind: Deployment
metadata:
  name: postgres
  namespace: sonarqube
spec:
  selector:
    matchLabels:
      app: postgres
  replicas: 1
  template:
    metadata:
      labels:
        app: postgres
    spec:
      containers:
        - name: postgres
          image: postgres:14.2
          imagePullPolicy: "IfNotPresent"
          ports:
            - containerPort: 5432
          env:
           - name: POSTGRES_USER
             valueFrom:
               secretKeyRef:
                 name: postgres-secrets
                 key: username
           - name: POSTGRES_PASSWORD
             valueFrom:
               secretKeyRef:
                 name: postgres-secrets
                 key: password
          volumeMounts:
            - mountPath: /var/lib/postgresql/data
              name: postgredb
      volumes:
        - name: postgredb
          persistentVolumeClaim:
            claimName: postgres-pv-claim

Hello @Somaninga_Pujari
Could you please indicate how you created the Kubernetes resources to run SonarQube? Are you using the official Sonarque helm chart ?