Hi all,
Hopefully someone else faced the following issue
When running a statefulset app with a postgres:11 and PVC , the postgres pod is always crashing with the following error
chmod: changing permissions of '/var/run/postgresql': Operation not permitted
chown: changing ownership of '/var/lib/postgresql/data/pgdata': Operation not permitted
I already did some research on the web (GitHub and stackoverflow) none of the solution provided works for me (unfortunately) .
Here is my yaml file
spec:
podManagementPolicy: OrderedReady
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: postgresql-db
serviceName: postgresql-db
template:
metadata:
creationTimestamp: null
labels:
app: postgresql-db
spec:
containers:
- envFrom:
- configMapRef:
name: postgres-configuration
image: postgres:11
imagePullPolicy: Always
name: postgresql-db
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: postgresql-db-disk
- mountPath: /docker-entrypoint-initdb.d/initdb.sql
name: psql-initdb-config
subPath: initdb.sql
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- configMap:
defaultMode: 420
name: psql-initdb-config
name: psql-initdb-config
updateStrategy:
rollingUpdate:
partition: 0
type: RollingUpdate
volumeClaimTemplates:
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
creationTimestamp: null
name: postgresql-db-disk
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: localstorage
volumeMode: Filesystem
and here is my conf.yaml
apiVersion: v1
data:
PGDATA: /var/lib/postgresql/data/pgdata
POSTGRES_DB: awesomedb
POSTGRES_PASSWORD: perfectpassword
POSTGRES_USER: postgres
kind: ConfigMap
name: postgres-configuration
namespace: default
please if anyone has already faced this issue, explain me what is going wrong with mine.
Best,