I have been reading about the ways in which I can push the database on kubernetes. Initially, I attached the data to the docker image and deployed the service and deployment files. But the issue was that when the container/pod restarts the data gets lost.
I, then, came across the concept of persistent volume claim. I found (https://www.magalix.com/blog/kubernetes-and-database) and (https://kubernetes.io/docs/tutorials/stateful-application/cassandra/) very useful. I have few questions regarding them though:
PVC:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
PV:
apiVersion: v1
kind: PersistentVolume
metadata:
name: mysql-pv-volume
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 20Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data"
- How does the PVC get the storage from PV in the cluster? If I am running my service using Amazon cloud, what are the steps for the same, if any.