liveBook · Manning

Hostpath volume

As explained in Acing the Certified Kubernetes Administrator Exam, Second Edition

A hostPath volume is a Kubernetes volume type that mounts a file or directory from the node's filesystem into a pod.

A hostPath volume mounts a directory from one Kubernetes node into a pod. Data remains on that node after the pod is deleted, but it is not synchronized across nodes and is lost if the node fails. section 7.1 section 7.1.1

Use these operational rules when configuring or evaluating a hostPath volume:

  • Provision it as a PersistentVolume when storage must outlive the pod. section 7.1.1
  • Use ReadWriteOnce (RWO); hostPath does not support ReadOnlyMany, ReadWriteMany, or ReadWriteOncePod. section 7.1.3
  • Plan for node placement because moving the pod to another node can expose different or missing data. section 7.1.1

Exam-style hostPath workflow

Create a 100 MB hostPath PersistentVolume named vol02833 using /mnt/data on worker node01. Create claim-02833 requesting 90 MB, then mount the claim in a frontend0113 Deployment at /usr/share/nginx/html. Verify the claim is Bound with kubectl get pvc, the PV is Bound with kubectl get pv, and the Deployment pod is Running with kubectl get deploy and kubectl get po. section 7.1

Figure 7.7 Abbreviated output from the kubectl describe po command, which shows the volume mounted to the pod
figure

Inspect the pod description to confirm that the configured volume is mounted inside the running pod. section 7.1

How Acing the Certified Kubernetes Administrator Exam, Second Edition covers it

How deep it goes
Explains local persistence, node-failure consequences, access-mode constraints, and verification, without detailing complete manifest syntax.
Examples
Uses vol02833, node01, /mnt/data, claim-02833, frontend0113, kubectl status output, and pod mount inspection.
What it assumes
Assumes a multi-node Kubernetes cluster and basic familiarity with pods, Deployments, PersistentVolumes, PersistentVolumeClaims, and kubectl.
What you can do after
Operate/configure a hostPath PV and claim, mount it in a Deployment, and verify binding, pod readiness, and the mounted volume.
How it connects
Connects PersistentVolume, PersistentVolumeClaim, Deployment, pod, node placement, and nfs volume through storage configuration choices.

Also explained in

Compare how 2 books explain hostpath volume →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Acing the Certified Kubernetes Administrator Exam, Second Edition. The section links point to the parts of the book it draws on.