I am trying to setup a postgres pod using minikube. I have the following in my pod config in my deployment
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: postgredb
volumes:
- name: postgredb
persistentVolumeClaim:
claimName: postgres-pv-claim
but when I run I get
initdb: error: directory "/var/lib/postgresql/data" exists but is not empty
It contains a dot-prefixed/invisible file, perhaps due to it being a mount point.
Using a mount point directly as the data directory is not recommended.
Create a subdirectory under the mount point.
so I change to
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: postgredb
subPath: db
But then I get...
2021-02-19 03:53:24.760 UTC [30] LOG: could not link file "pg_wal/xlogtemp.30" to "pg_wal/000000010000000000000001": Operation not permitted
2021-02-19 03:53:24.761 UTC [30] FATAL: could not open file "pg_wal/000000010000000000000001": No such file or directory
This is on OSX using minikube, how do I get it to work?
I also tried
env:
- name: PGDATA
value: /var/lib/postgresql/data/db_data
envFrom:
- configMapRef:
name: db-config
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: postgredb
subPath: db_data
But still get
2021-02-19 03:53:24.760 UTC [30] LOG: could not link file "pg_wal/xlogtemp.30" to "pg_wal/000000010000000000000001": Operation not permitted
2021-02-19 03:53:24.761 UTC [30] FATAL: could not open file "pg_wal/000000010000000000000001": No such file or directory