Search code examples
postgresqlkubernetespg-dump

Error while trying to dump Postgres db from pod


Could you please advice how to solve the issue I faced. I am trying to do dump from Kubernetes with the command:

kubectl exec auth-module -- bash -c "pg_dump -U pg-user database-name" > auth_database.sql

But the command above returns error:

error: Internal error occurred: error executing command in container: failed to exec in container: failed to start exec "d03940343fe6814b73186155bcb07812d51fe241be5fd3da02321d7922b31b8a": OCI runtime exec failed: exec failed: unable to start container process: exec: "bash": executable file not found in $PATH: unknown

What's wrong? Thanks in advance!


Solution

  • Specifying /bin/sh worked for me

    kubectl exec auth-module -- /bin/sh -c "pg_dump -U pg-user database-name" > auth_database.sql