Why are containers and the data inside them described as transient in Docker?
Containers are meant to run briefly and be deleted and by default any data written inside the container filesystem is deleted when the container is removed.
How do you persist data in Docker when a container is deleted?
You attach a volume when the container is created so the container writes data into the volume and the data remains even after the container is deleted.
How is the same persistence idea applied in Kubernetes?
Pods are also transient so you attach a volume to the pod and mount it into the container so data written to the mounted path survives after the pod is deleted.
In the lecture example what does the pod do and where does it write its output?
The pod generates a random number and writes it to a file under a path like slash opt out inside the container.
In the example what storage option is used for the volume and what host path is chosen?
The example uses a hostPath volume that maps to a directory on the node such as slash data.
How does the container access the volume in the example?
The pod uses volumeMounts to mount the volume into the container for example mounting the data volume at slash opt so writes inside slash opt go to the volume.
After the pod is deleted in the single node hostPath example where does the file still exist?
The file still exists on the node in the host directory such as slash data because the volume storage is outside the pod.
Why is hostPath not recommended for multi node clusters?
In a multi node cluster each node has its own local filesystem so slash data on one node is not the same as slash data on another and pods can move between nodes leading to inconsistent or missing data.
What kinds of storage backends does Kubernetes support besides hostPath?
Kubernetes supports many backends such as NFS GlusterFS Flocker Fibre Channel CephFS ScaleIO and cloud options like AWS EBS Azure Disk Azure File and Google Persistent Disk.
In the lecture how do you switch from hostPath storage to an AWS EBS volume?
You replace the hostPath section in the volume definition with an awsElasticBlockStore section and specify fields like the volume ID and filesystem type.
What is the key takeaway before moving on to persistent volumes?
Volumes let pods store data outside their transient lifecycle and the storage backend can be local like hostPath or external like cloud disks but persistent volumes build a more scalable model for managing that storage.