Kubernetes Storage and Volumes Explained in crash way

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Storage Types?

  • BLOCK Storage
    e.g – Laptop, ebs, disks,
  • Network Storage
    e.g – NFS, efs, files
  • OBJECT STORAGE
    e.g – git, google drive, s3, blob

How we can make kubernetes understanding these storage types for using in pods?

  • “volume plugins” which is in built in kubernetes

What are the volume plugins supported in kubernetes?

  • awsElasticBlockStore – AWS Elastic Block Store (EBS)
  • azureDisk – Azure Disk
  • azureFile – Azure File
  • cephfs – CephFS volume
  • cinder – Cinder (OpenStack block storage) (deprecated)
  • csi – Container Storage Interface (CSI)
  • fc – Fibre Channel (FC) storage
  • flexVolume – FlexVolume
  • flocker – Flocker storage
  • gcePersistentDisk – GCE Persistent Disk
  • glusterfs – Glusterfs volume
  • hostPath – HostPath volume (for single node testing only; WILL NOT WORK in a multi-node cluster; consider using local volume instead)
  • iscsi – iSCSI (SCSI over IP) storage
  • local – local storage devices mounted on nodes.
  • nfs – Network File System (NFS) storage
  • photonPersistentDisk – Photon controller persistent disk. (This volume type no longer works since the removal of the corresponding – cloud provider.)
  • portworxVolume – Portworx volume
  • quobyte – Quobyte volume
  • rbd – Rados Block Device (RBD) volume
  • scaleIO – ScaleIO volume (deprecated)
  • storageos – StorageOS volume
  • vsphereVolume – vSphere VMDK volume

Role & Responsibilties

Who would Add “Storage types” in clustor – kubernetes clustor administrator
Who would Use attached volume in clustor – kubernetes user and developer

How to Add “Storage types” using “volume plugins” to the kubernetes clustor by clustor administrator?

Manual -> STATIC - Costly - Faster			
Automatic Method -> DYNAMIC - less Costly - Less Faster   

		ADMIN			USER/DEVELOPER

STATIC		PV			PVC -> VOLUME ATTACHMENT TO POD -> Mount Inside a container
		CLUSTOR			NAMESPACE
DYNAMIC		SC -> PV		PVC -> VOLUME ATTACHMENT TO POD -> Mount Inside a container
		CLUSTOR			NAMESPACE

PV = Persistent Volumes
PVC = Persistent Volumes Claim
SC = StorageClass


STATIC	=> PV -> PVC -> VOLUME ATTACHMENT TO POD -> Mount Inside a container 
DYNAMIC => PVC(Request) -> SC -> PV -> PVC(Respected) -> VOLUME ATTACHMENT TO POD -> Mount Inside a container 




 534  mkdir pv
  535  cd pv
  536  clear
  537  ls
  538  vi pv.yaml
  539  kubectl get pv
  540  kubectl apply -f pv.yaml
  541  kubectl get pv
  542  vi pv.yaml
  543  kubectl apply -f pv.yaml
  544  kubectl get pv
  545  clear
  546  ls
  547  vi pvc.yaml
  548  kubectl get pvc
  549  kubectl get pv
  550  kubectl apply -f pvc.yaml
  551  kubectl get pvc
  552  kubectl get pv
  553  vi pvc.yaml
  554  kubectl apply -f pvc.yaml
  555  vi pvc.yaml
  556  kubectl apply -f pvc.yaml
  557  kubectl get pvc
  558  kubectl get pv
  559  clear
  560  vi pod.yaml
  561  kubectl apply -f pod.yaml
  562  kubectl get pods
  563  kubectl exec task-pv-pod ls /usr/share/nginx/html
  564  kubectl exec task-pv-pod touch /usr/share/nginx/html/index.html
  565  kubectl exec task-pv-pod ls /usr/share/nginx/html
  566  clear
  567  kubectl delete -f pod.yaml
  568  kubectl apply -f pod.yaml
  569  kubectl exec task-pv-pod ls /usr/share/nginx/html

Reference

Assignment

  • #1 – How certitifate based Authentication works? exaplain in kubernetes context.
  • #1 – What is Block Storage?
  • #3 – How volume plugins in kubernetes works?
  • #4 – What is StorageClass? and How to work with it with sample StorageClass, PV, PVC, POD.ymal