shlogg · Early preview
Cheedge Lee @cheedge

Kubernetes Storage Demos: HostPath & Local Type Examples

HostPath & Local Type Persistent Volumes in Kubernetes explained with simplified demos. HostPath ephemeral, no PVC needed. Local type requires PVC & StorageClass, nodeAffinity & automatic pod assignment.

In my previous post, shows the basic concepts for Storage in kubernetes, here I want to use some simplified demos to show how these concepts exactly used in a cluster.
Here we use one Emphemral volume -- HostPath type, and a Persistent Volume -- local type as two examples:

  
  
  HostPath Type

HostPath Type is an empheral volume, even if it will keep the stored file after Pod deleted.
Main Difference:

No PVC, directly bound with Pod
Manually create affinity for Pod


apiVersion: v1
kind: PersistentVolume
metadata:
  name: hostpath-pv
spec:
  capacity:
    storage: 100Mi
  accessModes:...