CertGrid CertGrid
Hands-on Lab·Certified Kubernetes Administrator

Volumes: emptyDir and hostPath

Two containers share an emptyDir, then the Pod is deleted and the data is gone. A hostPath survives that, and is read back from the node's own filesystem, but the identical path on another node holds nothing at all.

Storage Guide 65 of 103 Beginner

Written against the versions above. Disk sizes are this lab's. The lifetime rules are properties of the volume types.

Two worker nodes are used deliberately, to show what hostPath does not give you.
Server NameIP AddressOSRolesCPURAMHDD
CKA1001192.168.0.175Ubuntu 26.04 LTSControl Plane Node2 Core4 GB50 GB
CKA1001-NODE01192.168.0.176Ubuntu 26.04 LTSWorker Node2 Core4 GB50 GB
CKA1001-NODE02192.168.0.177Ubuntu 26.04 LTSWorker Node2 Core4 GB50 GB
CKA1001-NODE03192.168.0.178Ubuntu 26.04 LTSWorker Node2 Core4 GB50 GB

Before you start

  1. emptyDir is how two containers share a filesystem

  2. Delete the Pod and the emptyDir goes with it

  3. hostPath writes to the node, and you can prove it

  4. The same hostPath on another node is a different directory

Official sources