Skip to content

Using v18 Alpine image with CloudNativePG gives error mounting pvc to rootfs at "/var/lib/postgresql/data" #1393

@dadicarlo

Description

@dadicarlo

Hi,

I am trying to use the postgres:18-alpine with the CloudNativePG PostgreSQL Operator for Kubernetes, but it fails while mounting the PGDATA directory over the legacy path /var/lib/postgresql/data.

It seems like the operator has some problems with the fact that the postgres:18-alpine sets a symbolic link on /var/lib/postgresql/data that points to the new PGDATA directory starting with v18 (which is /var/lib/postgresql/data/18/docker). Although it has been claimed on #1372 that the symbolic link has been removed, it seems like it is still present on Alpine images (compare

RUN ln -svT . /var/lib/postgresql/data # https://github.com/docker-library/postgres/pull/1259#issuecomment-2215477494
and
RUN ln -svT . /var/lib/postgresql/data # https://github.com/docker-library/postgres/pull/1259#issuecomment-2215477494
).

The error messages from the operator are:

  Type     Reason     Age   From               Message
  ----     ------     ----  ----               -------
  Normal   Pulled     63s   kubelet            Container image "ghcr.io/cloudnative-pg/cloudnative-pg:1.27.2" already present on machine
  Normal   Created    63s   kubelet            Created container: bootstrap-controller
  Normal   Started    63s   kubelet            Started container bootstrap-controller
  Normal   Pulled     62s   kubelet            Container image "postgres:18-alpine" already present on machine
  Normal   Created    62s   kubelet            Created container: initdb
  Warning  Failed     62s   kubelet            Error: failed to create containerd task: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/var/local-path-provisioner/pvc-92114433-eafd-4c7d-9fb1-8d6d0ca69e67_hive_timescaledb-cluster-1" to rootfs at "/var/lib/postgresql/data": change mount propagation through procfd: open o_path procfd: open /run/containerd/io.containerd.runtime.v2.task/k8s.io/initdb/rootfs/var/lib/postgresql/data: no such file or directory

Other images, where the /var/lib/postgresql/data path can exist along with the new path (like https://github.com/cloudnative-pg/postgres-containers/pkgs/container/postgresql or https://hub.docker.com/r/timescale/timescaledb-ha) are working fine with CloudNativePG. And my guess is that postgres:18-alpine would also work fine, if just the symbolic link would be removed.

Furthermore, please note that CloudNativePG currently does not support configuring the PGDATA directory. Thus I need to use the legady path.

Therefore I would like to request that Debian and Alpine images both have the symbolic link removed.

Will also create a PR for this.

Greetings
Daniele

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions