Connecting Wiki.js to an existing PostgreSQL database using Azure Kubernetes

3/11/2020

I am currently using WikiJS 2.x and storing the data in a PostgresSQL persistent volume using Azure Kubernetes. After upgrading Kubernetes version to stay within the Azure supported versions, Wiki.JS got disconnected from the database, and when trying to reconnect it cannot see the data and attempts to create a new database every time.

Here is my deployment for the kubernetes postgres pod.

spec:
      containers:
      - env:
        - name: POSTGRES_USER
          value: <redacted>
        - name: POSTGRES_PASSWORD
          value: <redacted>
        - name: POSTGRES_DB
          value: wiki
        image: postgres:11.5
        imagePullPolicy: IfNotPresent
        name: postgres
        ports:
        - containerPort: 5432
          protocol: TCP
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/lib/postgresql/data
          name: postgresdb
      dnsPolicy: ClusterFirst
      hostname: postgrespod
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      subdomain: postgres
      terminationGracePeriodSeconds: 30
      volumes:
      - name: postgresdb
        persistentVolumeClaim:
          claimName: postgres-persistant-storage-postgres-0

Is there some specific setting in the deployment that needs to be changed to get it to use an existing database?

-- Kyounee
azure
azure-kubernetes
kubernetes-pvc
postgresql
wiki.js

0 Answers