Container storage in Kubernetes provides mechanisms for pods to access and persist data beyond the lifecycle of individual containers. Persistent Volumes (PVs) abstract storage resources from the underlying infrastructure, while Persistent Volume Claims (PVCs) let users request storage without knowing implementation details. StorageClasses enable dynamic provisioning, and CSI (Container Storage Interface) drivers standardize how storage providers integrate with Kubernetes. Understanding volume types, access modes, binding policies, and lifecycle management is essential for running stateful workloads—databases, message queues, file servers—that require data to survive pod restarts, rescheduling, and cluster failures.
What This Cheat Sheet Covers
This topic spans 17 focused tables and 85 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Ephemeral Volume Types
| Type | Example | Description |
|---|---|---|
volumes: - name: cache emptyDir: {} | • Temporary storage created when a pod is assigned to a node • data is lost when the pod is removed • useful for scratch space or caching. | |
emptyDir: medium: Memory sizeLimit: 1Gi | • In-memory tmpfs volume for ultra-fast temporary storage • counts against container's memory limit. | |
volumes: - name: logs hostPath: path: /var/log type: Directory | • Mounts a file or directory from the node's filesystem • survives pod restarts but tied to specific node • not recommended for production multi-node clusters. | |
volumes: - name: config configMap: name: app-config | • Projects ConfigMap data as files in the pod • used for non-sensitive configuration files • automatically updates when ConfigMap changes. | |
volumes: - name: creds secret: secretName: db-secret | • Projects Secret data as files • base64 encoded at rest • used for sensitive information like passwords or API keys. |