StorageClass & PVC
StorageClass
Commands
To list the StorageClass:
kubectl get storageclassTo describe a StorageClass:
kubectl describe storageclass <storageclass-name>To delete a StorageClass:
kubectl delete storageclass <storageclass-name>PVC (PersistentVolumeClaim)
Commands
To apply and run a PVC configuration:
kubectl apply -f pvc.yamlTo list the PVCs:
kubectl get pvcExample
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: myapp-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10GiHow to use in Deployment:
...
spec:
template:
...
spec:
containers:
- name: myapp-container
image: nginx:1.25
ports:
- containerPort: 80
volumeMounts:
- mountPath: /etc/pvc
name: myapp-volume
volumes:
- name: myapp-volume # Could be any arbitratry name
persistentVolumeClaim:
claimName: myapp-pvc # Specific name of the pvcLast updated