Kubernetes Persistence Volume

Advanced Concepts — Stateful applications

This article is part 2 of https://amulyareddyk97.medium.com/advanced-kubernetes-with-doks-d5fdd829eed4. Please go through the link.

  1. Volumes and Claims
  2. Life cycle of volumes and claims
  3. Provisioning types
  4. Binding and Mounting volume
  5. Statefulsets

Static PV

static-pv.yml

Life cycle of PV and PVC

static-pvc.yml

How to make PV visible inside a container

static-pv-pod.yml

Volume Binding — Phases

Reclaim Policy

CSI (Container Storage Interface)

In CSI, lets create Dynamic PV

csi-pvc.yml

Other topics

  1. Protection
  2. Expanding of Volume — change the size
  3. Cloning of Volume

Deletion order

Static: Delete Pod (removes mounting) -> Delete PVC (removes binding)-> Delete PV

Dynamic: Does automatically. Deleting PVC deleted PV.

Volume Cloning

Create snapshot out of PVC

snapshot-csi.yml

Creating new PVC out of snapshot

snapshot-pvc.yml

Clone PVC — not snapshot (pvc to pvc)

cloned-pvc.yml

StatefulSets

redis service

ReplicaSet is the opposite of StatefulSet. It is good for stateless applications.

ReplicaSet, StatefulSet, DeamonSet and Job/CronJobs are workloads.

DeamonSet — defines Pods that provide node-local facilities.

Other Useful commands

Consultant