I am using kubernetes to deploy a postgresql pod.
My k8s manifest for that works nicely. I only paste the relevant code below:
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: postgresql
spec:
...
template:
...
spec:
containers:
- name: postgresql
image: postgres:14
...
volumeMounts:
- name: my-postgres
mountPath: /var/lib/postgresql/data
...
volumeClaimTemplates:
- metadata:
name: my-postgres
spec:
As you can see above, under container spec, I declared the volumeMounts with a mount path. And a volumeClaimTemplates to provision the persistent in cloud.
Like said, it works fine.
when I open the Dockerfile of official postgresql here. On line 186, there is VOLUME /var/lib/postgresql/data.
I would like to verify if I understand the whole thing correctly:
Is it so that the line 186
VOLUME ...in postgres Dockerfile is only meant to tell its official mount point? I mean if I use the Dockerfile to run a container, it DOESN'T create a volume but I need to specific a volume & mount to that mount point. Am I right here?In my k8s manifest above, under
volumeMounts:themountPath:value has to be exactly the same as the line 186VOLUME ...in postgres Dockerfile, because that is the mount point they told. Am I right here?