Kubernetes Assignment– 3

Storage & Config Management

Basic Questions

  1. Create a Pod with an emptyDir volume mounted at /data and write a file inside it.
  2. Create a Pod with a hostPath volume mounted at /mnt/hostdata and verify persistence.
  3. Create a PersistentVolume (PV) with 1Gi capacity using hostPath.
  4. Create a PersistentVolumeClaim (PVC) that requests 500Mi storage.
  5. Bind the PVC to the PV and verify the status changes to Bound.
  6. Mount the PVC into a Pod and write data inside it.
  7. Delete the Pod and create a new one using the same PVC to verify persistence.
  8. Create a StorageClass with standard provisioner.
  9. Create a PVC that uses the standard StorageClass and verify dynamic provisioning.
  10. List all StorageClasses available in your cluster.
  11. Create a ConfigMap with key-value pairs (APP_MODE=dev, APP_DEBUG=true).
  12. Inject the ConfigMap into a Pod as environment variables.
  13. Inject the ConfigMap into a Pod as mounted files.
  14. Create a Secret with username and password (base64 encoded).
  15. Mount the Secret into a Pod as environment variables.
  16. Mount the Secret into a Pod as a volume.
  17. Inspect the Secret in YAML format and verify its encoding.
  18. Create a namespace storage-demo and deploy Pods with ConfigMaps inside it.
  19. Delete a PVC and verify if its bound PV is released or remains.
  20. Document the difference between emptyDir, hostPath, and persistentVolume.

Intermediate Questions

  1. Create a PV with 2Gi storage and access mode ReadWriteOnce.
  2. Create a PVC that requests the above PV and verify it is bound.
  3. Create a Deployment with 2 replicas that mount the same PVC (check if it works).
  4. Create a StatefulSet with 3 replicas, each with its own PVC.
  5. Create a Pod with two volumes mounted at /data1 and /data2.
  6. Create a PVC with ReadWriteMany and mount it into multiple Pods simultaneously.
  7. Create a dynamic PVC using the standard StorageClass and check its backing volume.
  8. Expand an existing PVC from 1Gi to 2Gi and verify the change.
  9. Run a Pod with a ConfigMap volume and check the mounted files.
  10. Update the ConfigMap and verify the Pod sees the changes.
  11. Use kubectl exec inside a Pod to print environment variables from a ConfigMap.
  12. Deploy a Pod with both ConfigMap and Secret mounted at different paths.
  13. Update a Secret value and restart the Pod to load new values.
  14. Write a Deployment that mounts a Secret for DB credentials and a ConfigMap for DB host.
  15. Create a Pod that references multiple ConfigMaps at once.
  16. Use a ConfigMap to configure Nginx (custom nginx.conf).
  17. Use a Secret to configure TLS certificates in Nginx.
  18. Verify Pod logs to confirm configuration was applied correctly.
  19. Create a YAML manifest combining PV, PVC, ConfigMap, and Pod.
  20. Demonstrate how to delete a PV and reclaim its storage.

Advanced Questions

  1. Create a PersistentVolume with 5Gi capacity backed by AWS EBS (or Minikube hostPath if local).
  2. Create a PVC requesting 5Gi storage and bind it to the above PV.
  3. Deploy MySQL using a Deployment with PVC mounted at /var/lib/mysql.
  4. Create a Secret for MySQL username and password.
  5. Create a ConfigMap for MySQL configuration (my.cnf).
  6. Inject both the Secret and ConfigMap into the MySQL Deployment.
  7. Expose the MySQL Deployment with a ClusterIP Service.
  8. Connect to MySQL Pod using kubectl exec and verify data persistence after restart.
  9. Delete the MySQL Pod and confirm data remains via PVC.
  10. 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.