Kubernetes Assignment– 3
Storage & Config Management
Basic Questions
- Create a Pod with an emptyDir volume mounted at /data and write a file inside it.
- Create a Pod with a hostPath volume mounted at /mnt/hostdata and verify persistence.
- Create a PersistentVolume (PV) with 1Gi capacity using hostPath.
- Create a PersistentVolumeClaim (PVC) that requests 500Mi storage.
- Bind the PVC to the PV and verify the status changes to Bound.
- Mount the PVC into a Pod and write data inside it.
- Delete the Pod and create a new one using the same PVC to verify persistence.
- Create a StorageClass with standard provisioner.
- Create a PVC that uses the standard StorageClass and verify dynamic provisioning.
- List all StorageClasses available in your cluster.
- Create a ConfigMap with key-value pairs (APP_MODE=dev, APP_DEBUG=true).
- Inject the ConfigMap into a Pod as environment variables.
- Inject the ConfigMap into a Pod as mounted files.
- Create a Secret with username and password (base64 encoded).
- Mount the Secret into a Pod as environment variables.
- Mount the Secret into a Pod as a volume.
- Inspect the Secret in YAML format and verify its encoding.
- Create a namespace storage-demo and deploy Pods with ConfigMaps inside it.
- Delete a PVC and verify if its bound PV is released or remains.
- Document the difference between emptyDir, hostPath, and persistentVolume.
Intermediate Questions
- Create a PV with 2Gi storage and access mode ReadWriteOnce.
- Create a PVC that requests the above PV and verify it is bound.
- Create a Deployment with 2 replicas that mount the same PVC (check if it works).
- Create a StatefulSet with 3 replicas, each with its own PVC.
- Create a Pod with two volumes mounted at /data1 and /data2.
- Create a PVC with ReadWriteMany and mount it into multiple Pods simultaneously.
- Create a dynamic PVC using the standard StorageClass and check its backing volume.
- Expand an existing PVC from 1Gi to 2Gi and verify the change.
- Run a Pod with a ConfigMap volume and check the mounted files.
- Update the ConfigMap and verify the Pod sees the changes.
- Use kubectl exec inside a Pod to print environment variables from a ConfigMap.
- Deploy a Pod with both ConfigMap and Secret mounted at different paths.
- Update a Secret value and restart the Pod to load new values.
- Write a Deployment that mounts a Secret for DB credentials and a ConfigMap for DB host.
- Create a Pod that references multiple ConfigMaps at once.
- Use a ConfigMap to configure Nginx (custom nginx.conf).
- Use a Secret to configure TLS certificates in Nginx.
- Verify Pod logs to confirm configuration was applied correctly.
- Create a YAML manifest combining PV, PVC, ConfigMap, and Pod.
- Demonstrate how to delete a PV and reclaim its storage.
Advanced Questions
- Create a PersistentVolume with 5Gi capacity backed by AWS EBS (or Minikube hostPath if local).
- Create a PVC requesting 5Gi storage and bind it to the above PV.
- Deploy MySQL using a Deployment with PVC mounted at /var/lib/mysql.
- Create a Secret for MySQL username and password.
- Create a ConfigMap for MySQL configuration (my.cnf).
- Inject both the Secret and ConfigMap into the MySQL Deployment.
- Expose the MySQL Deployment with a ClusterIP Service.
- Connect to MySQL Pod using kubectl exec and verify data persistence after restart.
- Delete the MySQL Pod and confirm data remains via PVC.
- Deliver a final project:
- PV + PVC + StorageClass → MySQL with persistent data
- ConfigMap for configuration → Secret for credentials
- Service for access → Test persistence across Pod restarts.