Kubernetes Simulator
intermediate · ~10 min
Config, not code
orders-api is the service behind the shop's checkout. It reads two settings from its environment: LOG_LEVEL, and DB_PASSWORD for its database (the password is s3cret-v1).
Settings belong in a ConfigMap and credentials in a Secret, never baked into the image or typed into the Deployment — so the same image runs in every environment and the password lives in one guarded place.
orders.yaml is waiting in your directory (cat orders.yaml). Make the ConfigMap and the Secret, wire them into the container's env with valueFrom, and apply it.
Objectives
- Create a ConfigMap orders-config with LOG_LEVEL=info
- Create a Secret orders-db holding the password s3cret-v1
- Run 2 ready orders pods that take LOG_LEVEL and DB_PASSWORD from them
- Bonus: Check what reached the container with kubectl set env deployment/orders --list
Best on a computer with a keyboard. It works on a phone, with shortcuts under the terminal.