kubernetes tutorial | Kubernetes Volumes | DEMO – How to create YAML Manifest for PV, PVC ?

Опубликовано: 11 Март 2026
на канале: VSPARKZ
246
7

CERTIFIED KUBERNETES ADMINISTRATOR

-------------------------------------------------------------------------




Kubernetes Tutorial | DEMO – How to create YAML Manifest for PV, PVC ?
---------------------------------------------------------------------------------------------------------------------


In this video, you are going to see a DEMO – How to create YAML Manifest for PV, PVC ?






For suggestions/feedback/doubts contact
email: [email protected]


Happy Learning !!!




===========================================================================================


USEFUL LINKS
---------------------------


Overview of Volumes


https://kubernetes.io/docs/concepts/s...


Persistent Volumes


https://kubernetes.io/docs/concepts/s...


Persistent Volumes Claims


https://kubernetes.io/docs/concepts/s...


Kubectl Command Reference*


https://kubernetes.io/docs/reference/...




==========================================================================================
#cka #kubernetes #k8s #containers




DEMO STEPS
****************


Step 1: Access & Inspect the Kubernetes Cluster



$ kubectl cluster-info


$ kubectl get nodes


$ kubectl get pods -n kube-system



Step 2: Create the Underlying Storage System (Local Storage)


In Worker 1


$ mkdir -p /pv/pv-1


In Worker 2


$ mkdir -p /pv/pv-2


$ mkdir -p /pv/pv-3


Step 3: Create and Apply “Persistent Volumes” using YAML Manifest


Create pv-1, pv-2, pv-3


Sample PV manifest
===============================================
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-1
spec:
accessModes:
ReadWriteMany
capacity:
storage: 1Gi
persistentVolumeReclaimPolicy: Retain
volumeMode: Filesystem
local:
path: /pv/pv-1
nodeAffinity:
required:
nodeSelectorTerms:
matchExpressions:
key: kubernetes.io/hostname
operator: In
values:
worker01.kubernetes.com
================================================


Step 4: Create and Apply “Persistent Volume Claims” using YAML Manifest


Create "pvc-claim"


Sample PVC Manifest
======================================
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-claim
spec:
accessModes:
ReadWriteOnce
volumeMode: Filesystem
resources:
requests:
storage: 2Gi
=======================================



THE END