Replies: 1 comment 2 replies
-
I think this: volumeMounts:
- name: data
mountPath: /var/lib/postgresql Needs to be: volumeMounts:
- name: data
mountPath: /var/lib/postgresql/data (The mount you're seeing at |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a StatefulSet With a PersistentVolume mounted to
/var/lib/postgresql
. Debian based Postgres images work as expected. Database is initialized and/var/lib/postgresql/data
folder is stored in the PersistentVolume.With Alpine based images the initialization process creates a separate mount for the
/var/lib/postgresql/data
folder to the OS disk. This will lead to data loss when the pod is recycled (data is not in the PersistenVolume).Not sure if this is a configuration problem in the StatefulSet itself. Atleast it is suprising behaviour which is hard to detect at first. It took me couple of times losing the data before suspecting something is wrong. It is not Longhorn related, I have seen the problem happen with AWS based storage too.
To reproduce checkout the following repository.
https://github.com/tuupola/postgres-alpine/
For documentation purposes this is the StateFulset config.
Beta Was this translation helpful? Give feedback.
All reactions