Skip to content

Postgres data folder empty on kubernetes #696

Closed
@MK-2001

Description

@MK-2001

Describe the situation

We are using postgres 11.7. We mount the data volume on /var/lib/postgresql via an cider pvc.
When we use the path /var/lib/postgresql/data the mount will be done with the permissions root:postgres. In this case postgres is not able to takeover the ownership for the folder .../data and aborts the startup with the message "Opertation not permitted".

When we mount the dir /var/lib/postgresql we can see the folders /var/lib/postgesql/data and during postgres is running there are all needed files. But after we stopped the container the folder .../data is empty.

What is expected

After shutdown the container there should be all data still available within the folder /var/lib/postgresql/data.

Alternative solutions:

The startup script may be not need the User-Ownership of the folder /var/lib/postgresql/data then it does not interrupt the startup.

Questions:

How to handle postgres with a docker image on kubernetes?
Is the .../data directory an hardlink directy?
Why there are no failes anymore in the directory after shutdown?

Similiar issues:

#103 / #560

  • But in kubernetes it is not possible to mount an volume not as root user. Just the group is changeable.
  • it seem to be an locking issue between postgres and k8s

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionUsability question, not directly related to an error with the image

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions