Don’t you love memes? Now there’s one explaining the 5 levels of storage available to Kubernetes. To the right >>>
Let’s go through a high-level overview of each level. You can then focus on the level that best matches your cluster’s needs.
Level 1 – Ephemeral Storage
What is it? Default storage state of every Kubernetes cluster. Each node contains “ephemeral” storage space.
Useful for: this is for storage of temporary user data within the VM. Works fine if your application doesn’t need to recall data.
Leaves off at: now, how many apps get by with temporary storage alone?
Level 2 – hostPath
What is it? The first step to running a persistent (rather than temporary) volume of any kind. hostPath uses a directory to emulate network-attached storage (NAS) within the node.
Useful for: development and testing on a single-node cluster.
Leaves off at: you wouldn’t use this on a production cluster because of its limited reach.
Level 3 – Static Persistent Volume
What is it? Proper storage for your applications at production. Static PVs are virtual views of physical storage. Users can then request PVs using Persistent Volume Claims (PVCs).
Useful for: when developers/operators are making simple, predictable claims for storage.
Leaves off at: requires user’s PVC to match what’s available. Chance of mismatch is higher as needs become more complex. Nodes risk losing out on available storage.
Level 4 – Dynamic Persistent Volume
What is it? A more robust form of Persistent Volume than the static version. Essentially automates the process of PV creation.
Useful for: situations where PVs are created based on demand rather than the other way round. Kicks in when static PVs are unable to provide storage for a specific PVC.
Leaves off at: it’s actually good enough for most applications. Well at least the ones that don’t get pummelled with 10s of thousands of users a day.
Level 5 – Topology-aware Volume Provisioner
What is it? Dynamic PVs are provisioned using scheduler input on the best positioning for the pod. Cuts risk of pod failure due to PV running in low CPU or memory VMs.
Best explained by this illustration where multiple zones are created with duplicate nodes :
Useful for: higher availability of applications especially in mission-critical situations. Increases fault tolerance by running workloads across several zones within a region.
Leaves off at: nothing. This is the ultimate level of Kubernetes storage. Master it and you’ve got a cluster that can handle almost any storage challenge.