Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bitnami/postgresql] - container CrashLooping with init scripts #25335

Closed
duncanwraight opened this issue Apr 23, 2024 · 5 comments
Closed

[bitnami/postgresql] - container CrashLooping with init scripts #25335

duncanwraight opened this issue Apr 23, 2024 · 5 comments
Assignees
Labels
postgresql solved stale 15 days without activity tech-issues The user has a technical issue about an application

Comments

@duncanwraight
Copy link

Name and Version

bitnami/postgresql 14.3.3

What architecture are you using?

amd64

What steps will reproduce the bug?

Deploy the Helm chart using helm install with the below values

Are you using any custom parameters or values?

primary:
  initdb:
    scripts:
      02_init_extensions.sh: |
        echo hello

What is the expected behavior?

Should see "hello" in the container logs

What do you see instead?

+ postgresql-0 › postgresql
postgresql-0 postgresql postgresql 15:40:13.90 INFO  ==> 
postgresql-0 postgresql postgresql 15:40:13.90 INFO  ==> Welcome to the Bitnami postgresql container
postgresql-0 postgresql postgresql 15:40:13.91 INFO  ==> Subscribe to project updates by watching https://github.com/bitnami/containers
postgresql-0 postgresql postgresql 15:40:13.91 INFO  ==> Submit issues and feature requests at https://github.com/bitnami/containers/issues
postgresql-0 postgresql postgresql 15:40:13.92 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-0 postgresql postgresql 15:40:13.92 INFO  ==> 
postgresql-0 postgresql postgresql 15:40:13.97 INFO  ==> ** Starting PostgreSQL setup **
postgresql-0 postgresql postgresql 15:40:14.00 INFO  ==> Validating settings in POSTGRESQL_* env vars..
postgresql-0 postgresql postgresql 15:40:14.02 INFO  ==> Loading custom pre-init scripts...
postgresql-0 postgresql postgresql 15:40:14.03 INFO  ==> Initializing PostgreSQL database...
postgresql-0 postgresql postgresql 15:40:14.07 INFO  ==> pg_hba.conf file not detected. Generating it...
postgresql-0 postgresql postgresql 15:40:14.07 INFO  ==> Generating local authentication configuration
postgresql-0 postgresql postgresql 15:40:14.11 INFO  ==> Deploying PostgreSQL with persisted data...
postgresql-0 postgresql postgresql 15:40:14.14 INFO  ==> Configuring replication parameters
postgresql-0 postgresql postgresql 15:40:14.21 INFO  ==> Configuring fsync
postgresql-0 postgresql postgresql 15:40:14.23 INFO  ==> Configuring synchronous_replication
postgresql-0 postgresql postgresql 15:40:14.31 INFO  ==> Loading custom scripts...
postgresql-0 postgresql postgresql 15:40:14.32 INFO  ==> Loading user's custom files from /docker-entrypoint-initdb.d ...
postgresql-0 postgresql postgresql 15:40:14.32 INFO  ==> Starting PostgreSQL in background...
postgresql-0 postgresql /opt/bitnami/scripts/libpostgresql.sh: line 775:    86 Killed                  "${pg_ctl_cmd[@]}" "start" "${pg_ctl_flags[@]}" > /dev/null 2>&1
- postgresql-0 › postgresql

Additional information

I'm honestly not sure what I'm doing wrong here. I want to write a more complex shell script to be able to create some databases dynamically, but I can't even get that far!

I have tried fully removing the Helm chart and the PVC then reinstalling - no change.

@duncanwraight duncanwraight added the tech-issues The user has a technical issue about an application label Apr 23, 2024
@github-actions github-actions bot added the triage Triage is needed label Apr 23, 2024
@javsalgar javsalgar changed the title bitnami/postgresql - container CrashLooping with init scripts [bitnami/postgresql] - container CrashLooping with init scripts Apr 24, 2024
@javsalgar
Copy link
Contributor

Hi,

It seems to me that the "Killed" message has to do with the pod going over certain memory limits. This is strange as we did not see that behavior in our tests in all major k8s distributions. Could you check if increasing the resources (you can use the resourcesPreset value for testing) solves the issue?

@duncanwraight
Copy link
Author

Thanks @javsalgar but I'm not sure that's the case:

postgresql-0 postgresql postgresql 09:30:02.77 INFO  ==> Loading custom scripts...
postgresql-0 postgresql postgresql 09:30:02.77 INFO  ==> Loading user's custom files from /docker-entrypoint-initdb.d ...
postgresql-0 postgresql postgresql 09:30:02.77 INFO  ==> Starting PostgreSQL in background...
postgresql-0 postgresql /opt/bitnami/scripts/libpostgresql.sh: line 775:    89 Killed                  "${pg_ctl_cmd[@]}" "start" "${pg_ctl_flags[@]}" > /dev/null 2>&1
- postgresql-0 › postgresql
^C
❯ kpodrescheck
Name           CPU-request   MEM-request   CPU-limit    MEM-limit
postgresql-0   1             2Gi           1500m       3Gi

Even with plenty of CPU and memory the same issue occurs - and it only happens when I try to include an initdb script. No issues running the container without one

@github-actions github-actions bot removed the triage Triage is needed label Apr 25, 2024
@github-actions github-actions bot assigned dgomezleon and unassigned javsalgar Apr 25, 2024
@dgomezleon
Copy link
Member

Weird,

I could not reproduce that with the lastest version of the chart. You can see the hello string in the logs:

$ kubectl logs postgresql-0

postgresql 14:15:38.64 INFO  ==>
postgresql 14:15:38.73 INFO  ==> Welcome to the Bitnami postgresql container
postgresql 14:15:38.73 INFO  ==> Subscribe to project updates by watching https://github.com/bitnami/containers
postgresql 14:15:38.73 INFO  ==> Submit issues and feature requests at https://github.com/bitnami/containers/issues
postgresql 14:15:38.74 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 14:15:38.74 INFO  ==>
postgresql 14:15:38.93 INFO  ==> ** Starting PostgreSQL setup **
postgresql 14:15:39.13 INFO  ==> Validating settings in POSTGRESQL_* env vars..
postgresql 14:15:39.14 INFO  ==> Loading custom pre-init scripts...
postgresql 14:15:39.23 INFO  ==> Initializing PostgreSQL database...
postgresql 14:15:39.34 INFO  ==> pg_hba.conf file not detected. Generating it...
postgresql 14:15:39.43 INFO  ==> Generating local authentication configuration
postgresql 14:15:45.33 INFO  ==> Starting PostgreSQL in background...
postgresql 14:15:46.33 INFO  ==> Changing password of postgres
postgresql 14:15:46.73 INFO  ==> Configuring replication parameters
postgresql 14:15:47.03 INFO  ==> Configuring synchronous_replication
postgresql 14:15:47.03 INFO  ==> Configuring fsync
postgresql 14:15:47.43 INFO  ==> Stopping PostgreSQL...
waiting for server to shut down.... done
server stopped
postgresql 14:15:47.64 INFO  ==> Loading custom scripts...
postgresql 14:15:47.65 INFO  ==> Loading user's custom files from /docker-entrypoint-initdb.d ...
postgresql 14:15:47.65 INFO  ==> Starting PostgreSQL in background...
hello
postgresql 14:15:48.33 INFO  ==> Enabling remote connections
postgresql 14:15:48.43 INFO  ==> Stopping PostgreSQL...
waiting for server to shut down.... done
server stopped
postgresql 14:15:48.64 INFO  ==> ** PostgreSQL setup finished! **

postgresql 14:15:48.74 INFO  ==> ** Starting PostgreSQL **
2024-04-26 14:15:48.937 GMT [1] LOG:  pgaudit extension initialized
2024-04-26 14:15:49.034 GMT [1] LOG:  starting PostgreSQL 16.2 on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
2024-04-26 14:15:49.035 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2024-04-26 14:15:49.035 GMT [1] LOG:  listening on IPv6 address "::", port 5432
2024-04-26 14:15:49.040 GMT [1] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2024-04-26 14:15:49.047 GMT [155] LOG:  database system was shut down at 2024-04-26 14:15:48 GMT
2024-04-26 14:15:49.131 GMT [1] LOG:  database system is ready to accept connections

Copy link

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

@github-actions github-actions bot added the stale 15 days without activity label May 12, 2024
Copy link

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

@bitnami-bot bitnami-bot closed this as not planned Won't fix, can't repro, duplicate, stale May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
postgresql solved stale 15 days without activity tech-issues The user has a technical issue about an application
Projects
None yet
Development

No branches or pull requests

4 participants