filmov
tv
kubernetes tutorial | Kubernetes Volumes | Demo: create PV, PVC & Mount it a Pod using Local Storage

Показать описание
*CERTIFIED KUBERNETES ADMINISTRATOR*
-------------------------------------------------------------------------
*Kubernetes Tutorial | DEMO Create PV PVC and Mount it in a Pod*
-----------------------------------------------------------------------------------------------------------
In this video, you are going to see a DEMO on how to create PV, PVC and mount the same into the Pod.
For suggestions/feedback/doubts contact
Happy Learning !!!
===========================================================================================
*USEFUL LINKS*
----------------------------
*Overview of Volumes*
*Persistent Volumes*
* Kubectl Command Reference*
==========================================================================================
#cka #kubernetes #k8s #container
*DEMO STEPS*
****************
*Step 1: Access & Inspect the Kubernetes Cluster*
$ kubectl cluster-info
$ kubectl get nodes
$ kubectl get pods -n kube-system
*Step 2: Create Persistent Volumes using Local Storage (Static Provisioning)*
*In Worker 1*
$ mkdir -p /pv/pv-1
*In Worker 2*
$ mkdir -p /pv/pv-2
*Create pv-1 & pv-2*
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:
operator: In
values:
================================================
*Step 3: Create Persistent Volumes Claims*
_Create pvc-1 & pvc-2_
Sample PVC Manifest
======================================
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-1
spec:
accessModes:
- ReadWriteMany
volumeMode: Filesystem
resources:
requests:
storage: 1Gi
=======================================
*Step 4: Create Pods and Mount the Persistent Volume Claims*
_Create Pod-1 and Pod-2 and mount the PVC's respectively_
Sample POD Manifest
===============================================
apiVersion: v1
kind: Pod
metadata:
labels:
app: apache
name: pod-1
spec:
volumes:
- name: myvolume-1
persistentVolumeClaim:
claimName: pvc-1
containers:
- image: httpd
name: apache
volumeMounts:
- name: myvolume-1
mountPath: /usr/local/apache2/htdocs/
==================================================
*Step 5: Create some data within the Pod and check the data persistence*
Create some data under the mountpath folder
$ kubectl exec -it pod-1 -- sh
*Step 6: Delete Pod-2 and Create Pod-3 with Pod 2’s PVC claim*
$ kubectl delete pod pod-2
Now create pod-3 with pod-2's pvc claim and validate the data in pod-3
_THE END_
-------------------------------------------------------------------------
*Kubernetes Tutorial | DEMO Create PV PVC and Mount it in a Pod*
-----------------------------------------------------------------------------------------------------------
In this video, you are going to see a DEMO on how to create PV, PVC and mount the same into the Pod.
For suggestions/feedback/doubts contact
Happy Learning !!!
===========================================================================================
*USEFUL LINKS*
----------------------------
*Overview of Volumes*
*Persistent Volumes*
* Kubectl Command Reference*
==========================================================================================
#cka #kubernetes #k8s #container
*DEMO STEPS*
****************
*Step 1: Access & Inspect the Kubernetes Cluster*
$ kubectl cluster-info
$ kubectl get nodes
$ kubectl get pods -n kube-system
*Step 2: Create Persistent Volumes using Local Storage (Static Provisioning)*
*In Worker 1*
$ mkdir -p /pv/pv-1
*In Worker 2*
$ mkdir -p /pv/pv-2
*Create pv-1 & pv-2*
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:
operator: In
values:
================================================
*Step 3: Create Persistent Volumes Claims*
_Create pvc-1 & pvc-2_
Sample PVC Manifest
======================================
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-1
spec:
accessModes:
- ReadWriteMany
volumeMode: Filesystem
resources:
requests:
storage: 1Gi
=======================================
*Step 4: Create Pods and Mount the Persistent Volume Claims*
_Create Pod-1 and Pod-2 and mount the PVC's respectively_
Sample POD Manifest
===============================================
apiVersion: v1
kind: Pod
metadata:
labels:
app: apache
name: pod-1
spec:
volumes:
- name: myvolume-1
persistentVolumeClaim:
claimName: pvc-1
containers:
- image: httpd
name: apache
volumeMounts:
- name: myvolume-1
mountPath: /usr/local/apache2/htdocs/
==================================================
*Step 5: Create some data within the Pod and check the data persistence*
Create some data under the mountpath folder
$ kubectl exec -it pod-1 -- sh
*Step 6: Delete Pod-2 and Create Pod-3 with Pod 2’s PVC claim*
$ kubectl delete pod pod-2
Now create pod-3 with pod-2's pvc claim and validate the data in pod-3
_THE END_
Комментарии