I installed Crunchydata Postgres Operator on K8S by following this link
I found the following link to create PG Cluster using postgres-cluster.yaml link
When I try to create the Postgres cluster using
kubectl create -f postgres-cluster.yml
it errored with the following
[root@ontrol01 ~]# kubectl logs -n pgo deployment.apps/hippo | more
/opt/crunchy/bin/postgres-ha/bootstrap-postgres-ha.sh: line 198: /pgdata/hippo.initial
izing: Permission denied
initdb: error: could not create directory "/pgdata/hippo": Permission denied
pg_ctl: database system initialization failed
I tried by adding the "securitycontext" to postgres-cluster.yaml (tailored output) but it does not work. I might be wrong here
apiVersion: crunchydata.com/v1
kind: Pgcluster
metadata:
annotations:
current-primary: hippo
labels:
crunchy-pgha-scope: hippo
deployment-name: hippo
name: hippo
pg-cluster: hippo
pgo-version: 4.6.2
pgouser: admin
name: hippo
namespace: pgo
spec:
securityContext:
runAsUser: 0
runAsGroup: 0
I am able to find similar issue in SO but I am not sure what should be added where to fix the postgres permission denied issue