Configure api deployment in namespace app using MODE=production and a database password without baking either value into the image.
Objectifs
- Create ConfigMap api-config with MODE=production
- Create Secret db-creds with password=s3cur3
- Reference both from Deployment api
Étapes suggérées
- Create each data object imperatively.
- Use valueFrom with configMapKeyRef and secretKeyRef.
- Inspect the Pod environment definition.
Indices
Voir la solution
kubectl create configmap api-config -n app --from-literal=MODE=production kubectl create secret generic db-creds -n app --from-literal=password=s3cur3 # Add env.valueFrom references to the Deployment and apply.