How to configure a Pod to use the updated configMap?

0 votes
I have a pod that is using a config map ,which I updated and now I want the container to be updated with those changes, what should I do?
Jul 18, 2019 in Kubernetes by Karan
• 9,500 points
61 views

1 answer to this question.

0 votes
  • If the config map is mounted into the pod as a volume, it will automatically update not instantly, and the files will change inside the container. 

  • If it is an environment variable it stays as the old value until the container is restarted.

For example: create a new config.yaml with your custom values

apiVersion: v1
kind: ConfigMap
metadata:
name: testconfig
namespace: default
data:
config.yaml: |
namespaces:
default
labels:
"app"
"owner"

Then create a pod definition, referencing the ConfigMap

apiVersion: v1
kind: Pod
metadata:
name: testobject
spec:
serviceAccountName: testobject
containers:
name: testobject
image: test/appv1
volumeMounts:
name: config-volume
mountPath: /app/config.yaml
subPath: config.yaml
volumes:
name: config-volume
configMap:
name: testconfig
restartPolicy: Never
answered Jul 18, 2019 by Sirajul
• 50,480 points

Related Questions In Kubernetes

0 votes
0 answers

How to access the configmap created on a worker node, in the pod.yaml in Master?

1. Configmap is created on the node1. ...READ MORE

3 days ago in Kubernetes by jayabmaguluri
• 140 points
41 views
0 votes
1 answer

Configure a Kubernetes-pod to use persistent volume for storage.

The output shows that the PersistentVolume has ...READ MORE

answered Jul 23, 2019 in Kubernetes by Sirajul
• 50,480 points
765 views
0 votes
1 answer

How to use gravitational teleport in a container/kubernetes environment?

You can use teleport to augment kubernetes ...READ MORE

answered Jun 28, 2018 in Kubernetes by ajs3033
• 7,280 points
614 views
0 votes
1 answer

How to start and stop a cluster on AWS using kops without stopping the instance

Export your KOPS_STAT_STORE variable export KOPS_STATE_STORE=s3://your-bucket-name Get your instances ...READ MORE

answered Jan 8, 2019 in Kubernetes by Kashish
2,463 views
0 votes
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17, 2019 in Others by anonymous
5,634 views
+4 votes
1 answer

Installing Web UI (Dashboard):kubernetes-dashboard on main Ubuntu 16.04.6 LTS (Xenial Xerus) server

Follow these steps: $ kubeadm reset $ kubeadm init ...READ MORE

answered Apr 11, 2019 in Kubernetes by Kalgi
• 51,830 points

reshown Apr 12, 2019 by Kalgi 1,536 views
+1 vote
1 answer

How to use a Volume to communicate between two Containers running in the same Kubernetes-Pod?

Create a Pod that runs two Containers Create a ...READ MORE

answered Jul 23, 2019 in Kubernetes by Sirajul
• 50,480 points
550 views
0 votes
1 answer

how to drain the traffic from a pod?

When we take the node for maintenance, ...READ MORE

answered Jul 17, 2019 in Kubernetes by Sirajul
• 50,480 points
76 views