Skip to content

Replica fails to promote when run as non-root <Defect> #194

@cschultz-ibm

Description

@cschultz-ibm

Containers should not be run as root. But in v1.17, the promote_replica_to_primary.sh script in base-kubegres-config ConfigMap was changed to write messages to /usr/share/promotion.log. In the postgres container, /usr/share is only writable by root. Thus, when the container is run as postgres, promotion fails because the PostStartHook fails, leaving the replica pod in a CrashLoopBackoff state.

It is not clear why the 1.16 version of the script, which wrote to STDOUT, was changed to write to a promotion.log file. If there is some need for it, then it needs to be placed in a directory writable by the user running the postgres pod. If not, then simply removing the redirects to go back to STDOUT would be the solution.

The change needs to be made in the promote_replica_to_primary.sh script defined in the internal/controller/spec/template/yaml/BaseConfigMapTemplate.yaml and internal/controller/spec/template/yaml/Templates.go.

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