Interview Prep/Kubernetes/Configuration & Storage

Why is `hostPath` discouraged and what are the safer alternatives?

IntermediateConceptConfiguration & Storage
Answer

It mounts a node directory into the Pod, tying it to a node and allowing container escape or host data exposure if it reaches / or the container runtime socket. Use PVCs, emptyDir, or local PersistentVolumes with node affinity. Legitimate uses are node agents in DaemonSets, ideally read-only.

All Kubernetes questions Roadmap: Kubernetes core

More on Configuration & Storage