I am trying to mount postgrsql persitance volume in kubernetes locally with static provisioning. Here is my yaml file i created pv , pvc and pod
apiVersion: v1
kind: PersistentVolume
metadata:
name: task-pv-volume
namespace: manhattan
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 100Mi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: task-pv-claim
namespace: manhattan
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 80Mi
---
apiVersion: v1
kind: Pod
metadata:
name: dbr-postgres
namespace: manhattan
spec:
volumes:
- name: task-pv-storage
persistentVolumeClaim:
claimName: task-pv-claim
containers:
- name: task-pv-container
image: postgresql:2.0.1
tty: true
volumeMounts:
- mountPath: "/var/lib/pgsql/9.3/data"
name: task-pv-storage
subPath: data
readOnly: false
nodeSelector:
kubernetes.io/hostname: k8s-master
My volume lies in the /var/lib/pgsql/9.3/data but my pod fails and i don't want to change the location of mountPath to /var/lib/pgsql/9.3/data/backup
can you please suggest any overwrite option in yaml file
I don't want to create the folder with new name here .
If i changed the mountPath to /var/lib/pgsql/9.3/data/backup the pod starts running but i dont want that i want the data to writtend in the same directory /var/lib/pgsql/9.3/data