lectures.alex.balgavy.eu

Lecture notes from university.
git clone git://git.alex.balgavy.eu/lectures.alex.balgavy.eu.git
Log | Files | Refs | Submodules

storage.md (1653B)


      1 +++
      2 title = 'Storage'
      3 +++
      4 # Storage
      5 ## Volumes
      6 Pod hosts containers with a writable layer, which is lost if the container crashes.
      7 Volumes provide sharable storage that survives crashes, are attached to lifecycle of pod (not container).
      8 
      9 A volume is directory that's accessible to containers in a pod.
     10 
     11 Types of volumes:
     12 - emptyDir: created when pod assigned to node, exists as long as pod is running on the node. Initially empty. When a pod is removed from a node, data in it is deleted. Safe across crashes. Stored on the node storage.
     13 - hostPath: allows containers to access path in filesystem of node on which the pod runs, owned by root:root. With multiple nodes not very useful, because not clear on which node the hostPath storage will be used.
     14 - nfs: Network File System. Not provided by Kubernets, must install your own NFS server. Can be shared between pods and mounted by multiple writers simultaneously.
     15 
     16 ## Persistent Volumes
     17 Decoupled from that of pods, i.e. created independently from pods.
     18 Persistent Volume Claims express storage requirements of an app, and Kubernetes binds Persistent Volume Claims to Persistent Volumes.
     19 
     20 PVs can be provisioned:
     21 - statically: created in advance by an admin, ready to be consumed by PVCs.
     22 - dynamically (based on StorageClasses): when none of static PVs matches the PVC, the cluster may try to dynamically provision a volume that matches (admin has to enable DefaultStorageClass admission controller on API server)
     23 
     24 Reclaiming: what happens to storage and data after you delete PVC:
     25 - retain: when PVC deleted, PV is not.
     26 - delete: when PVC deleted, PV and data is also deleted
     27 - recycle: deprecated.