Skip to content

PostgreSQL 18 Compatibility: PGDATA Directory Change Not Supported by Kubegres Manager #198

@Javimenendez

Description

@Javimenendez

PostgreSQL 18 Compatibility – PGDATA Directory Change Not Supported

Description

With the release of PostgreSQL 18, the default PGDATA directory and the corresponding environment variable have changed. According to the official Docker PostgreSQL documentation:

Important Change: the PGDATA environment variable of the image was changed to be version specific in PostgreSQL 18 and above. For 18 it is /var/lib/postgresql/18/docker. Later versions will replace 18 with their respective major version (e.g., /var/lib/postgresql/19/docker for PostgreSQL 19.x).

Problem

When deploying Kubegres with PostgreSQL 18, setting the PGDATA environment variable via customConfig or env does not work as expected. The Kubegres manager container appears to calculate or override this variable internally, rather than using the value provided in the environment.

As a result, the cluster fails to initialize correctly with PostgreSQL 18, since the scripts and volume mounts do not align with the new directory structure.

Workaround

The only way I have found to make Kubegres work with PostgreSQL 18 is to manually edit the base-kubegres-config ConfigMap (created automatically in each namespace) and replace all references to $PGDATA with the explicit path /var/lib/postgresql/18/docker.

This is not ideal, as it requires manual intervention and is not future-proof for subsequent PostgreSQL versions.

References

Request

  • Please update Kubegres to allow the PGDATA environment variable to be set via the custom environment variables, and ensure that all internal scripts and logic respect this value.
  • Alternatively, provide a documented and automated way to support the new PGDATA structure for PostgreSQL 18+.

Thank you for your work on Kubegres!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions