/
Kubernetes Introductory EXERCISES-2

Kubernetes Introductory EXERCISES-2

Exercise 6: Using ConfigMaps to Store Configuration

  1. Create a ConfigMap that holds some application configuration (e.g., environment variables or a small config file).

  2. Deploy a Pod (or Deployment) that uses this ConfigMap:

    • As environment variables or mounted as a file.

  3. Verify that the application/container is reading the configuration from the ConfigMap.

Key Concepts: ConfigMaps, environment variables, file mounts, Pod configuration.


Exercise 7: Storing Sensitive Data with Secrets

  1. Create a Kubernetes Secret that contains a username and password (base64 encoded).

  2. Deploy a Pod (or Deployment) that:

    • Uses the Secret as environment variables or as a mounted file.

  3. Verify you can access the sensitive data inside the container while ensuring it remains encrypted at rest within the cluster.

Key Concepts: Secrets, secure data management, environment variables vs. volume mounts.


Exercise 8: Exposing Apps via Ingress

  1. Install an Ingress Controller (e.g., AWS Load Balancer Controller or NGINX Ingress Controller) on your EKS cluster.

  2. Deploy two different services (e.g., Service A running on path /app1, Service B on path /app2).

  3. Create an Ingress resource that routes requests based on the URL path:

    • /app1 → Service A

    • /app2 → Service B

  4. Confirm external traffic is correctly routed to each service based on the path.

Key Concepts: Ingress, path-based routing, single external endpoint for multiple services.


Exercise 9: Taints and Tolerations

  1. Taint one of your worker nodes so that only Pods with a matching toleration can be scheduled on it.

  2. Deploy a Pod (or Deployment) with the proper toleration to run on the tainted node.

  3. Verify that Pods without the toleration cannot schedule onto the tainted node.

Key Concepts: Node isolation, workload scheduling, cluster node customization.


Exercise 10: Scheduled Tasks with CronJobs

  1. Create a CronJob that runs a simple script/container on a schedule (e.g., every 1–2 minutes) which prints a message.

  2. Check the Jobs created by the CronJob to ensure they complete successfully.

  3. Observe how the Jobs appear and terminate on schedule.

Key Concepts: CronJobs, scheduled containers, ephemeral workloads.