Your container image should be the same in dev, staging, and production. What changes between those places is configuration: log levels, feature flags, database passwords. In this part you learn how Kubernetes keeps that configuration out of your images using ConfigMaps and Secrets, how to feed it to containers as environment variables or files, and β just as important β what Secrets actually protect and what they absolutely do not.
What you need
A working local cluster and kubectl from Part 1 .
The clinerds-demo Deployment from Part 4 β we will recreate it below with config wired in, so no worries if your cluster is fresh.
A rough idea of what an environment variable is, and comfort with kubectl apply -f .
Recipe 1: A ConfigMap for app settings
Problem: Your app needs settings like a log level and a greeting, and you refuse to rebuild the image every time one of them changes.
A ConfigMap is a named bag of plain-text key-value pairs that lives in the cluster.β¦