8. K8 Volumes

Need for Volumes

Used to persist data in K8


Storage Requirements

  1. Storage that dont depend on pod lifecycle

  2. Storage must be available on all nodes

  3. Storage needs to survive even if cluster crashes


Volume Types

1. Persistent Volume

  • a cluster resource

  • created via YAML file

  • needs actual physical storage like local disk, nfs server or cloud storage

  • These volumes are not namespaced

  • Local volumes violate 2 and 3 requirement for storage

2. Persistant Volume Claims (PVC)

  • Used by services to claim the created volume for use

  • Claims must be in the same namespace

ConfigMap & Secret

  • Do not use PV or PVC

3. Storage Class

  • Provision Persistent Volumes Dynamically when PVC claims it

  • Can be created via YAML file

    • Storage Backend is defined in SC component

      • via provisioner attribute

      • each storage backend has own provisioner

      • internal provisioner - kubernetes.io

      • external provisioner

    • Configure parameters for storage

  • Same as PV, it is claimed by PVC in the pods


Last updated