PSQLException: ERROR: relation "internal_properties" does not exist

  • Versions:

    SonarQube running on K8S.
    Using the community edition docker container.

> containers:
        - name: sonarqube
             image: sonarqube:community
* Community Edition
* Version 9.6.1 (build 59531)

Using postgreSQL deployment as DB

containers:
        - name: postgres
          image: postgres:latest

PostgreSQL 14.5 (Debian 14.5-1.pgdg110+1)

*Goal:
Setting up sonarQube portal and to run the scans. This works for around some 4 hours and after that I am getting this error in the kubectl logs

Error seen in SonarQube container

at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.postgresql.util.PSQLException: ERROR: relation “es_queue” does not exist
Position: 168
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2676)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2366)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:356)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:490)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:408)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:181)
at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:170)

The error seen in DB container is below

2022-10-06 10:35:28.124 UTC [97] ERROR:  relation "internal_properties" does not exist at character 125
2022-10-06 10:35:28.124 UTC [97] STATEMENT:  select
	      kee as "key",
	      is_empty as empty,
	      text_value as value,
	      created_at as createdAt
	    from
	      internal_properties
	    where
	      kee in  (  $1 )```

The full Deployment YAML for sonarqube

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: sonarqube
  name: sonarqube
  namespace: sonar-dev
spec:
  selector:
    matchLabels:
      app: sonarqube
  replicas: 1
  template:
    metadata:
      labels:
        app: sonarqube
    spec:
      containers:
        - name: sonarqube
          image: sonarqube:community
          env:
          - name: "SONARQUBE_JDBC_USERNAME"
            valueFrom:
               secretKeyRef:
                 name: postgres-secrets
                 key: username
          - name: "SONARQUBE_JDBC_URL"
            valueFrom:
              configMapKeyRef:
                name: sonar-config
                key: url
          - name: "SONARQUBE_JDBC_PASSWORD"
            valueFrom:
               secretKeyRef:
                 name: postgres-secrets
                 key: password
          ports:
          - containerPort: 9000
            protocol: TCP

The DB deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: postgres
  namespace: sonar-dev
spec:
  selector:
    matchLabels:
      app: postgres
  replicas: 1
  template:
    metadata:
      labels:
        app: postgres
    spec:
      containers:
        - name: postgres
          image: postgres:latest
          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_new
              name: postgredb
      volumes:
        - name: postgredb
          persistentVolumeClaim:
            claimName: postgres-pv-claim

Hey! solved this problem?