Table of contents
Open Table of contents
K8s storage types
- Persistent Volume
- Lifecycle: eternal, independent
- Support external storage
- Emphemeral Volume
- Lifecycle: with Pod life
- Support external storage
- Projected Volume
- Config Map/Secret/Service Account mounted as files
How K8s workload consume storage resouces
Volume
Persistent Volume
PV + PVC (Statically provisioned PV)
Relationship: 1 to 1
Storage Class + PVC (Dynamically provisioned PV)
For those storage type that can allocate/deallocate new disk spaces, Storage Class provide the ability to dynamically PV for each PVC as well.
For example, Azure Files supports to create File Shares. When a new PVC is bind to StorageClass, K8s then notifies StorageClass.provisioner
to help create a PV and a Azure File Share that this PV use as the storage base.
https://kubernetes-csi.github.io/docs/external-provisioner.html
How K8s controller plane manage storage resources
Volume plugin
Volume is a virtual concept in K8S to describe storage resources available for workloads(Pods). When a pod consuming a volume, it doesnβt cares about how it is mounted onto the container file system. The procedure is achieved by k8s control plane, container runtime and volume plugin together.
Volume Plugin is the component which controls how disks are attached, unattached, mounted, unmounted onto Nodes.
Third party storage: CSI volume plugin & CSI volume driver
K8s natively supports several in-tree volume plugins to manage commonly used storage. But to decouple and support more 3rd party volume plugins, it provides a CSI volume plugin(in-three) that enable third party CSI volume drivers(out-of-tree) to be used in Kubernetes.
Term | Definition |
---|---|
Container Storage Interface (CSI) | A specification attempting to establish an industry standard interface that Container Orchestration Systems (COs) can use to expose arbitrary storage systems to their containerized workloads. |
in-tree | Code that exists in the core Kubernetes repository. |
out-of-tree | Code that exists somewhere outside the core Kubernetes repository. |
CSI Volume Plugin | A new, in-tree volume plugin that acts as an adapter and enables out-of-tree, third-party CSI volume drivers to be used in Kubernetes. |
CSI Volume Driver | An out-of-tree CSI compatible implementation of a volume plugin that can be used in Kubernetes through the Kubernetes CSI Volume Plugin. |
Details about CSI volume plugin design
external containerized CSI volume driver
external provisioner mechanism
Dynamically create PV
todo
Network-attached Storage
Advanced: OpenEBS
References
- CSI Volume Plugins design doc: https://github.com/kubernetes/design-proposals-archive/blob/main/storage/container-storage-interface.md
- CSI specification: https://github.com/container-storage-interface/spec/blob/master/spec.md
- K8s storage basics for PV, PVC, Storage Class: https://blog.mayadata.io/kubernetes-storage-basics-pv-pvc-and-storageclass