Kubernetes Storage
- CSI is a storage interface for k8s
-
List of CSI drivers Refer Here
- Refer Here for official docs of PVs
- Refer Here for official docs of Storage Classes
- Access Modes
- RWO – ReadWriteOnce (Suitable for block storages like EBS, Azure Disk, Persistent Disk)
- ROX – ReadOnlyMany (Any disk)
- RWX – ReadWriteMany (Typically fileshares or blob storages)
- RWOP – ReadWriteOncePod (Suitable for block storages like EBS, Azure Disk, Persistent Disk)
- Refer Here for using Azure Disk as PV
Lets create a mysql Pod where we create a persitent volume dynamically
- Refer Here for the changes done.
- Exercise: Try running mongodb with pvc and postgres with pvc
Necesity for database cluster
- To have HA we run database in multiple servers in the case of k8s multiple pods
- IN db cluster we have multiple servers and each server will have its own storage
- So we need to create pods and each pod should have its own persistent volume
- challenge to create cluster with deployments:
- managing multiple PVs
- pod names are not predictable: database clusters generally will have predictable endpoints (read endpoint, write endpoint)
- So we need a way to create
- multiple pods and pvs
- pod names should be predicatable
- all of the above are acheived with stateful sets
