bitnami / charts

Bitnami Helm Charts
https://bitnami.com
Other
8.83k stars 9.12k forks source link

[bitnami/postgresql] data directory "/bitnami/postgresql/data" has wrong ownership #29144

Open kper3360 opened 2 weeks ago

kper3360 commented 2 weeks ago

Name and Version

/bitnami/postgresql/16.4.0-debian-12-r5

What architecture are you using?

None

What steps will reproduce the bug?

Environment- AWS EKS V 1.28

kubectl logs -f  my-postgresql-0     
postgresql 16:05:51.64 INFO  ==> 
postgresql 16:05:51.72 INFO  ==> Welcome to the Bitnami postgresql container
postgresql 16:05:51.73 INFO  ==> Subscribe to project updates by watching https://github.com/bitnami/containers
postgresql 16:05:51.73 INFO  ==> Submit issues and feature requests at https://github.com/bitnami/containers/issues
postgresql 16:05:51.73 INFO  ==> Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit https://bitnami.com/enterprise
postgresql 16:05:51.74 INFO  ==> 
postgresql 16:05:51.83 DEBUG ==> Configuring libnss_wrapper...
postgresql 16:05:51.92 DEBUG ==> Copying files from /opt/bitnami/postgresql/conf.default to /opt/bitnami/postgresql/conf
postgresql 16:05:51.93 INFO  ==> ** Starting PostgreSQL setup **
postgresql 16:05:52.04 INFO  ==> Validating settings in POSTGRESQL_* env vars..
postgresql 16:05:52.14 INFO  ==> Loading custom pre-init scripts...
postgresql 16:05:52.15 INFO  ==> Initializing PostgreSQL database...
postgresql 16:05:52.22 DEBUG ==> Ensuring expected directories/files exist...
postgresql 16:05:52.32 INFO  ==> pg_hba.conf file not detected. Generating it...
postgresql 16:05:52.33 INFO  ==> Generating local authentication configuration
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /bitnami/postgresql/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 20
selecting default shared_buffers ... 400kB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
2024-08-31 16:05:55.147 UTC [101] FATAL:  data directory "/bitnami/postgresql/data" has wrong ownership
2024-08-31 16:05:55.147 UTC [101] HINT:  The server must be started by the user that owns the data directory.
child process exited with exit code 1
initdb: removing contents of data directory "/bitnami/postgresql/data"

Are you using any custom parameters or values?

no

What is the expected behavior?

No response

What do you see instead?

After I installed the Helm chart the the pod went to crashloopbackoff status.

my-postgresql-0 0/1 CrashLoopBackOff 10 (80s ago) 28m

Additional information

No response

javsalgar commented 1 week ago

Hi!

Could you add more details on the PVC provider you are using? It may have incompatibilities with fsGroup

kper3360 commented 1 week ago

I use EFS CSI Provisioner

javsalgar commented 6 days ago

Could you try with the volume permissions init container? volumePermissions.enabled=true?

kper3360 commented 6 days ago

Could you try with the volume permissions init container? volumePermissions.enabled=true?

I tried it. But it didn't work

javsalgar commented 6 days ago

Could you deploy the chart with diagnosticMode.enabled=true, enter the container with kubectl exec and check the permissions on the volume folder?

kamontat commented 6 days ago

@javsalgar I have same problem.

CleanShot 2024-09-09 at 16 49 52@2x

The default user id of EFS is 50011, so I tried below config but it doesn't works.

volumePermissions:
  enabled: true
  containerSecurityContext:
    runAsUser: 50011
    runAsGroup: 50011
    runAsNonRoot: false

CleanShot 2024-09-09 at 16 51 00@2x

javsalgar commented 5 days ago

Even with that user/group, you are unable to perform a touch command inside the container? What error does it show?