I'm attempting to create a persistent volume claim for my pgadmin deployment so I can persist my settings, servers, etc. when I rollout updates after each deployment from CD pipeline.
In my logs I'm getting the following errors:
...
[2020-10-05 00:54:56 +0000] [91] [INFO] Worker exiting (pid: 91)
WARNING: Failed to set ACL on the directory containing the configuration database:
[Errno 1] Operation not permitted: '/var/lib/pgadmin'
HINT : You may need to manually set the permissions on
/var/lib/pgadmin to allow pgadmin to write to it.
ERROR : Failed to create the directory /var/lib/pgadmin/sessions:
[Errno 13] Permission denied: '/var/lib/pgadmin/sessions'
HINT : Create the directory /var/lib/pgadmin/sessions, ensure it is writeable by
'pgadmin', and try again, or, create a config_local.py file
and override the SESSION_DB_PATH setting per
https://www.pgadmin.org/docs/pgadmin4/4.26/config_py.html
Just a bunch of permission failures for writing:
PGAdmin deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: pgadmin
spec:
selector:
matchLabels:
app: pgadmin
replicas: 1
template:
metadata:
labels:
app: pgadmin
spec:
containers:
- name: pgadmin4
image: dpage/pgadmin4
volumeMounts:
- mountPath: /var/lib/pgadmin
name: pgadminstorage
env:
- name: PGADMIN_DEFAULT_EMAIL
valueFrom:
secretKeyRef:
name: un
key: un
- name: PGADMIN_DEFAULT_PASSWORD
valueFrom:
secretKeyRef:
name: pw
key: pw
- name: PGADMIN_PORT
value: "80"
ports:
- containerPort: 80
name: pgadminport
volumes:
- name: pgadminstorage
persistentVolumeClaim:
claimName: pgadmin-persistent-volume-claims-cfg
Volumes
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pgadmin-persistent-volume-claims-cfg
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
What could I be missing here?
Update:
This might be a problem specific to digitalocean and inability to set permissions. PVC will set perms to root, but writing as pgadmin is causing issues at startup Adding this to my pgadmin deployment fixed everything
initContainers:
- name: pgadmin-data-permission-fix
image: busybox
command: ["/bin/chown", "-R", "5050:5050", "/var/lib/pgadmin"]
volumeMounts:
- name: pgadminstorage
mountPath: /var/lib/pgadmin
You could probably also chmod recursive on the dir as well and also be fine.