In Kubernetes, why is it important to keep configuration data separate from application code?
Think about how changing settings without changing the app code helps in real life.
Separating configuration allows you to change settings like database URLs or feature flags without rebuilding or redeploying the app container. This makes updates faster and safer.
What is the result of running kubectl apply -f configmap.yaml before applying deployment.yaml that uses this ConfigMap?
kubectl apply -f configmap.yaml kubectl apply -f deployment.yaml
Think about how Kubernetes uses ConfigMaps when pods start.
Applying the ConfigMap first ensures it exists when the Deployment creates pods. Pods then load configuration from the ConfigMap correctly.
You want to update configuration for a running Kubernetes app without downtime. Which workflow achieves this?
Consider how pods read config and when they pick up changes.
Pods read ConfigMap data at startup. Updating ConfigMap alone doesn't reload pods. Restarting pods via rollout restart applies new config without downtime.
You updated a ConfigMap but your running pod still shows old configuration values. What is the most likely reason?
Think about how pods consume ConfigMap data and when they refresh it.
Pods mount ConfigMaps as files or environment variables at startup. Changes to ConfigMaps do not reflect until pods restart or reload.
What is the main advantage of using ConfigMaps and Secrets for configuration in Kubernetes instead of hardcoding values directly inside Deployment manifests?
Think about security, flexibility, and ease of updates in real-world apps.
ConfigMaps and Secrets separate config and sensitive data from app code, enabling secure, centralized updates without rebuilding images or redeploying apps unnecessarily.