Inject a ConfigMap and a Secret as Env Vars

easy 10 XP ~7 minHands-on lab

The mailer Deployment in the analytics namespace still has its settings baked into the image. The team wants them moved into the cluster: plain settings in a ConfigMap, the database password in a Secret, both delivered to the containers as environment variables.

Task

  • Create a ConfigMap mailer-settings in analytics with exactly these keys: APP_MODE=staging, LOG_LEVEL=debug, REGION=us-east.
  • Create a Secret mailer-db in analytics with the key password set to meadow.
  • The container of Deployment mailer receives every key of mailer-settings as an environment variable of the same name.
  • The same container receives the Secret's password key as the environment variable DATABASE_PASSWORD.
  • All 2 replicas of mailer are available with the new configuration.
  • Leave the ConfigMap mailer-legacy as it is.

A practice cluster is running on this machine: start with kubectl get deploy,configmap,secret -n analytics.

About this machine

Ubuntu 24.04 with a private practice cluster: a real Kubernetes API server, scheduler and controllers, and three nodes (controlplane, node01, node02). Containers are simulated, so images never download and kubectl logs/exec are not available. k is an alias for kubectl, with completion. The grader checks the cluster's final state, not the commands you typed.

TerminalNot started

Your machine is ready to start

Create a free account to open a machine and get graded.

Inject a ConfigMap and a Secret as Env Vars — hands-on lab · BrokenCluster