GKE Persistent Disks Existing StorageClass premium-rwo
Step-00: Pre-requisites¶
- Verify if GKE Cluster is created
- Verify if kubeconfig for kubectl is configured in your local terminal
- Feature: Compute Engine persistent disk CSI Driver
- Verify the Feature Compute Engine persistent disk CSI Driver enabled in GKE Cluster.
- This is required for mounting the Google Compute Engine Persistent Disks to Kubernetes Workloads in GKE Cluster.
Step-01: Introduction¶
- Understand Kubernetes Objects
- Kubernetes PersistentVolumeClaim
- Kubernetes ConfigMap
- Kubernetes Deployment
- Kubernetes Volumes
- Kubernetes Volume Mounts
- Kubernetes Environment Variables
- Kubernetes ClusterIP Service
- Kubernetes Init Containers
- Kubernetes Service of Type LoadBalancer
-
Kubernetes StorageClass
-
Use the predefined Storage class
premium-rwo - By default, dynamically provisioned PersistentVolumes use the default StorageClass and are backed by
standard hard disks. - If you need faster SSDs, you can use the
premium-rwostorage class from the Compute Engine persistent disk CSI Driver to provision your volumes. - This can be done by setting the storageClassName field to
premium-rwoin your PersistentVolumeClaim premium-rwo Storage Classwill provisionSSD Persistent Disk
Step-02: List Kubernetes Storage Classes in GKE Cluster¶
Step-03: 01-persistent-volume-claim.yaml¶
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-pv-claim
spec:
accessModes:
- ReadWriteOnce
storageClassName: premium-rwo
resources:
requests:
storage: 4Gi
Step-04: Other Kubernetes YAML Manifests¶
- No changes to other Kubernetes YAML Manifests
- They are same as previous section
- 01-persistent-volume-claim.yaml
- 02-UserManagement-ConfigMap.yaml
- 03-mysql-deployment.yaml
- 04-mysql-clusterip-service.yaml
- 05-UserMgmtWebApp-Deployment.yaml
- 06-UserMgmtWebApp-LoadBalancer-Service.yaml
Step-05: Deploy kube-manifests¶
# Deploy Kubernetes Manifests
kubectl apply -f kube-manifests/
# List Storage Classes
kubectl get sc
# List PVC
kubectl get pvc
# List PV
kubectl get pv
# List ConfigMaps
kubectl get configmap
# List Deployments
kubectl get deploy
# List Pods
kubectl get pods
# List Services
kubectl get svc
# Verify Pod Logs
kubectl get pods
kubectl logs -f <USERMGMT-POD-NAME>
kubectl logs -f usermgmt-webapp-6ff7d7d849-7lrg5
Step-06: Verify Persistent Disks¶
- Go to Compute Engine -> Storage -> Disks
- Search for
4GBPersistent Disk - Observation: You should see the disk type as SSD persistent disk
Step-07: Access Application¶
# List Services
kubectl get svc
# Access Application
http://<ExternalIP-from-get-service-output>
Username: admin101
Password: password101
Step-08: Clean-Up¶
Reference¶
🎉 New Course
Ultimate DevOps Real-World Project Implementation on AWS
$15.99
$84.99
81% OFF
DEVOPS2026FEB
Enroll Now on Udemy
🎉 Offer