RunAsUser issue with postgres

45 Views Asked by At

I have encountered error when I am running the postgreSQL in OKD.

The error message I encountered is: Peer authentication failed for user "postgres"

I have customized the pg_hba.conf file and this is the configuration I put for the local connection: local postgres all peer

As per some security, I am required to put it as peer authentication.

In the statefulset.yaml file, I am required to configure the RunAsUser and RunAsGroup securityContext, and here is how I did it

spec:
    securityContext: 
        runAsUser: 10001
        runAsGroup: 10001
        fsGroup: 10001
    serviceAccountName: ...
    containers:
    - name: db
    image: ....
    volumeMounts:
        - name: data
        mountPath: /var/lib/postgresql/data
    securityContext:
        seccompProfile: 
            type: RuntimeDefault
        runAsNonRoot: true
0

There are 0 best solutions below