I'm starting to work with Google Kubernetes Engine.
I have successfully started up an app with a deployment config.
GKE set up a pod to run the containerized app inside it.
I want to load a config map into the pod as environment variables.
From the docs it says to load the config map to the pod
.
But shouldn't I load it to the deployment
?
If the pod is restarted, all the changes are discarded, right?
If you deployed your pods through a deployment, yes, you should put them in your Deployment
definition under the template
for your pods. Most people use the Deployments, DaemonSets, StatefulSets or HPAs abstractions to manage the Kubernetes pods because the can take care of the scaling, redundancy, replicas, etc.
The Kubernetes documentation uses pods quite a bit as examples and they do work. So if you wonder what happens if you add ConfigMap to a pod. Then you will have to manage the pods yourself, that means deleting, and recreating the pods manually. For example to delete kubectl delete pod <pod-name>
and to create kubectl create -f <pod-definition>