
concepts
Updated a ConfigMap and the pod still has the old value: the four paths, measured
ConfigMap updated but the pod still sees the old value? Env vars and subPath never change in a running container; volume files do, up to 90 seconds later.
Whether a pod sees a ConfigMap edit depends on how it reads the ConfigMap, not
on the ConfigMap. Environment variables (env.valueFrom, envFrom) and
subPath mounts are resolved when the container is created, and never change
while it runs. A whole-volume mount (configMap, secret or projected) is
rewritten in place by the kubelet, but only on the pod’s next sync, which on a
default kubelet is anywhere from a second to about a minute and a half later.
So “the pod still has the old value” has four answers, and only for the two volume paths is the answer “wait”. The same rules apply to Secrets, which go through the same change-detection setting and the same file writer.
| How the container reads it | Changes in a running container? | When it changes |
|---|---|---|
env.valueFrom / envFrom | No | Next container start |
volumes[].configMap / secret | Yes | Next pod sync: measured 1–84s |
volumes[].projected | Yes | Same sync, same moment |
volume mounted with subPath | No | Next container start |
An immutable: true ConfigMap is not a fifth path: you cannot edit it at all.
The fastest check
List every way the pod consumes a ConfigMap or Secret, and whether that way ever updates:
kubectl get pod consumer -o json | jq -r '(.spec.volumes | map({(.name): (.configMap.name // .secret.secretName // ([.projected.sources[]? | .configMap.name // .secret.name // empty] | join(",")))}) | add) as $vol | .spec.containers[] | .name as $c | (.env[]? | select(.valueFrom.configMapKeyRef or .valueFrom.secretKeyRef) | [$c, "env " + .name, (.valueFrom.configMapKeyRef.name // .valueFrom.secretKeyRef.name), "no"]), (.envFrom[]? | [$c, "envFrom", (.configMapRef.name // .secretRef.name), "no"]), (.volumeMounts[]? | select($vol[.name] != "") | [$c, .mountPath, $vol[.name], (if .subPath then "no (subPath)" else "yes" end)]) | @tsv'
app env GREETING app-config no
app /etc/cfg app-config yes
app /etc/sub/greeting app-config no (subPath)
app /etc/proj app-config yes
app /var/run/secrets/kubernetes.io/serviceaccount kube-root-ca.crt yes
Then compare when the ConfigMap was last written with when the container started:
kubectl get configmap app-config -o jsonpath='{range .metadata.managedFields[*]}{.time}{"\t"}{.manager}{"\t"}{.operation}{"\n"}{end}'
kubectl get pod consumer -o jsonpath='{range .status.containerStatuses[*]}{.name}{"\t"}{.state.running.startedAt}{"\n"}{end}'
2026-09-30T07:44:43Z kubectl-client-side-apply Update
2026-09-30T08:03:07Z kubectl-patch Update
app 2026-09-30T07:54:27Z
The ConfigMap changed at 08:03:07, the container started at 07:54:27. Every
row marked no above is still serving the value from before 07:54:27. Rows
marked yes will catch up on their own. Everything in this article was run on
a kind cluster on Kubernetes 1.36.1, with the timing and restart results
repeated on 1.37.0; the source references are to release-1.36 and
release-1.37.
One pod, four paths, one edit
This pod reads the same key four ways and prints all four every second:
apiVersion: v1
kind: Pod
metadata:
name: consumer
spec:
containers:
- name: app
image: busybox:1.36
command:
- sh
- -c
- |
while true; do
echo "$(date -u +%H:%M:%S) env=$GREETING vol=$(cat /etc/cfg/greeting) sub=$(cat /etc/sub/greeting) proj=$(cat /etc/proj/greeting)"
sleep 1
done
env:
- name: GREETING
valueFrom:
configMapKeyRef:
name: app-config
key: greeting
volumeMounts:
- name: cfg
mountPath: /etc/cfg
- name: cfg
mountPath: /etc/sub/greeting
subPath: greeting
- name: proj
mountPath: /etc/proj
volumes:
- name: cfg
configMap:
name: app-config
- name: proj
projected:
sources:
- configMap:
name: app-config
The ConfigMap was patched three times, a little over two minutes apart, at
07:47:19 (v2), 07:49:29 (v3) and 07:51:39 (v4):
kubectl patch configmap app-config --type merge -p '{"data":{"greeting":"v2"}}'
The log, reduced to the lines where something changed:
kubectl logs consumer | uniq -f1
07:44:43 env=v1 vol=v1 sub=v1 proj=v1
07:47:29 env=v1 vol=v2 sub=v1 proj=v2
07:50:01 env=v1 vol=v3 sub=v1 proj=v3
07:52:31 env=v1 vol=v4 sub=v1 proj=v4
The volume and the projected volume changed together, 10, 32 and 52 seconds
after each edit. The environment variable and the subPath file never changed.
A second pod on the same node, mounting the same ConfigMap, caught up after
20, 26 and 68 seconds. The same test on 1.37.0 gave 18, 38 and 43 seconds.
To see the spread properly, a Deployment of ten replicas on 1.36.1 mounting one ConfigMap, edited three times: thirty measurements, fastest 1 second, median 43, slowest 84. Pods that started together on the same node received the same edit more than a minute apart. That is not a fault. It is the design.
How the kubelet updates a mounted ConfigMap
The kubelet does not push ConfigMap changes to pods. Its ConfigMap cache learns about the edit almost immediately; the files on disk change only when that pod’s worker next syncs the pod, and a sync rewrites every volume that asks for it.
In the source, line numbers as release-1.36 / release-1.37:
- The cache.
configMapAndSecretChangeDetectionStrategypicks one of three managers inpkg/kubelet/kubelet.go(line 657 / 685):Watch(a watch per referenced object),Cache(a TTL cache, one minute unless the node carries anode.alpha.kubernetes.io/ttlannotation) orGet(straight to the API server).Watchis the default inpkg/kubelet/apis/config/v1beta1/defaults.go(line 271 / 269), and has been since 1.12 (#64752). - The sync. After each successful sync,
completeWorkinpkg/kubelet/pod_workers.gorequeues the pod afterwait.Jitter(resyncInterval, 0.5)(line 1531 on both branches):syncFrequencyplus a random extra of up to half as much again. With the defaultsyncFrequencyof one minute (defaults.goline 79 / 77), each pod is synced every 60 to 90 seconds, or sooner if something about the pod itself changes. - The remount. Every sync calls
WaitForAttachAndMount(kubelet.goline 2196 / 2230), which callsReprocessPod(pkg/kubelet/volumemanager/volume_manager.goline 415 / 440). The populator then marks every volume whose plugin returnstruefromRequiresRemountas needing a remount (desired_state_of_world_populator.goline 327). ConfigMap, Secret, projected and downwardAPI volumes all returntrue. - The write. The ConfigMap plugin’s
SetUpAtreads the object from the cache and hands it toAtomicWriter.Writeinpkg/volume/util/atomic_writer.go(line 139 / 141).
This node’s kubelet is on the defaults:
kubectl get --raw /api/v1/nodes/glance-blog-control-plane/proxy/configz | jq '.kubeletconfig | {syncFrequency, configMapAndSecretChangeDetectionStrategy}'
{
"syncFrequency": "1m0s",
"configMapAndSecretChangeDetectionStrategy": "Watch"
}
The ConfigMap concepts page
describes it correctly: “the total delay from the moment when the ConfigMap is
updated to the moment when new keys are projected to the Pod can be as long as
the kubelet sync period + cache propagation delay, where the cache propagation
delay depends on the chosen cache type (it equals to watch propagation delay,
ttl of cache, or zero correspondingly).” On the default Watch strategy the
propagation part is small, and the sync period, with its jitter, is almost all
of the wait. The task page
still says the kubelet “uses its local TTL-based cache” and puts the worst case
at “kubelet sync period (1 minute by default) + TTL of ConfigMaps cache (1
minute by default)”. That describes the Cache strategy, which has not been
the default since 1.12.
..data: why the file is a symlink
AtomicWriter never edits a file in place. The files you see are symlinks
into a directory named after the time it was written, reached through a
second symlink called ..data. Before and after the first edit:
kubectl exec consumer -- ls -la --full-time /etc/cfg
drwxr-xr-x 1 root root 16 2026-09-30 07:44:43 +0000 ..2026_09_30_07_44_43.1507511842
lrwxrwxrwx 1 root root 32 2026-09-30 07:44:43 +0000 ..data -> ..2026_09_30_07_44_43.1507511842
lrwxrwxrwx 1 root root 15 2026-09-30 07:44:43 +0000 greeting -> ..data/greeting
drwxr-xr-x 1 root root 16 2026-09-30 07:47:28 +0000 ..2026_09_30_07_47_28.2048640562
lrwxrwxrwx 1 root root 32 2026-09-30 07:47:28 +0000 ..data -> ..2026_09_30_07_47_28.2048640562
lrwxrwxrwx 1 root root 15 2026-09-30 07:44:43 +0000 greeting -> ..data/greeting
greeting is the same symlink it was at 07:44:43. What changed is where
..data points. Write compares the payload with the files already there
(shouldWriteFile, line 341 / 343) and stops if nothing differs. Otherwise it
creates ..<UTC timestamp>.<random> with os.MkdirTemp (line 399 / 401),
writes the files into it, creates a symlink ..data_tmp pointing at it,
renames ..data_tmp over ..data (line 233 / 235), and deletes the old
timestamped directory. A rename is atomic, so a reader never opens a
half-written file: a path resolved through ..data lands wholly in the old
directory or wholly in the new one. Projected volumes use the same writer; the
only difference visible here is that they sit on tmpfs, as Secret volumes do
(projected.go line 63 / 65).
Why a file watcher misses the update
That scheme is exactly why an application that watches its config file with inotify never reloads. The file it is watching is never modified. It is unlinked, along with the old directory it lives in.
A second pod mounting the same ConfigMap ran two busybox inotifyd watchers,
one on /etc/cfg/greeting and one on the /etc/cfg directory, printing a
timestamp with each event. The file watcher, across the same three edits:
07:45:00 file r /etc/cfg/greeting
07:45:00 file a /etc/cfg/greeting
07:45:00 file 0 /etc/cfg/greeting
07:46:21 file r /etc/cfg/greeting
07:46:21 file a /etc/cfg/greeting
07:46:21 file 0 /etc/cfg/greeting
07:47:39 file r /etc/cfg/greeting
07:47:39 file a /etc/cfg/greeting
07:47:39 file 0 /etc/cfg/greeting
07:47:39 file e /etc/cfg/greeting
07:47:39 file D /etc/cfg/greeting
07:47:39 file x /etc/cfg/greeting
The r, a, 0 groups (opened, read, closed) are the kubelet itself,
comparing the file on each sync: 07:45:00, 07:46:21, 07:47:39, 81 and 78
seconds apart. That is the 60–90 second sync, visible from inside the pod. At
07:47:39 the content differed. The watcher got a metadata change (e, the link
count dropping), D (the file was deleted) and x: the kernel removed the
watch. No modify event (c) or close-after-write event (w) ever arrived,
and after x there was nothing left to watch. The file watcher printed nothing
at all for the next two edits.
The directory watcher, filtered to entries being created, moved and deleted:
07:47:39 dir n /etc/cfg ..2026_09_30_07_47_39.284388745
07:47:39 dir n /etc/cfg ..data_tmp
07:47:39 dir m /etc/cfg ..data_tmp
07:47:39 dir y /etc/cfg ..data
07:47:39 dir d /etc/cfg ..2026_09_30_07_45_00.3314690686
07:49:55 dir n /etc/cfg ..2026_09_30_07_49_55.4170531261
07:49:55 dir n /etc/cfg ..data_tmp
07:49:55 dir m /etc/cfg ..data_tmp
07:49:55 dir y /etc/cfg ..data
07:49:55 dir d /etc/cfg ..2026_09_30_07_47_39.284388745
07:52:47 dir n /etc/cfg ..2026_09_30_07_52_47.3842903867
07:52:47 dir n /etc/cfg ..data_tmp
07:52:47 dir m /etc/cfg ..data_tmp
07:52:47 dir y /etc/cfg ..data
07:52:47 dir d /etc/cfg ..2026_09_30_07_49_55.4170531261
Every edit ends in y ..data: an IN_MOVED_TO for the name ..data. The
comment on AtomicWriter says as much (line 55 / 57): “Consumers of the target
directory can monitor the ..data symlink using inotify or fanotify to receive
events when the content in the volume is updated.” Watch the directory and
react to ..data, re-add a file watch after it is removed, or simply re-read
the file on a timer or on SIGHUP. A program that opens the file each time it
needs a value, as the cat loop above does, never has this problem.
subPath: a bind mount of one old file
A subPath mount is not a view into the volume directory. When the container
is created, doBindSubPath in pkg/volume/util/subpath/subpath_linux.go (line
174 / 188) resolves every symlink in the path with filepath.EvalSymlinks
(line 185 / 199), so greeting becomes ..data/greeting becomes
..2026_…/greeting, and bind-mounts that one file into the container (line
219 / 233). When the kubelet later swaps ..data and deletes the old
directory, the bind mount still holds the old file. The mount table says so,
here on 1.37.0 after the volume had been updated three times:
kubectl exec consumer -- grep /etc/sub /proc/self/mountinfo
15910 15860 0:38 /docker/volumes/41a3…/_data/lib/kubelet/pods/c4d44959-…/volumes/kubernetes.io~configmap/cfg/..2026_09_30_07_51_50.322024047/greeting//deleted /etc/sub/greeting ro,noatime - btrfs /dev/vdb1 rw,…
//deleted: the container is reading a file that no longer exists anywhere
else. The official note is one line: “A container using a ConfigMap as a
subPath volume mount will not receive ConfigMap updates.”
Env vars and subPath are per container, not per pod
The usual advice is that env and subPath need “a pod restart”. The source
says less than that: a container restart is enough.
Environment variables are built by makeEnvironmentVariables
(pkg/kubelet/kubelet_pods.go line 734 / 756), which fetches the ConfigMap
through the same manager (line 786 / 808). It runs from
GenerateRunContainerOptions, which generateContainerConfig calls
(pkg/kubelet/kuberuntime/kuberuntime_container.go line 344) each time a
container is created. subPath has the same timing, and on a restart
prepareSubpathTarget compares the existing bind mount with what the path
resolves to now (checkSubPathFileEqual, line 107 / 114), unmounts it if they
differ and binds the new file. That came in 1.19 with
#89629, and the e2e test
“should verify that container can restart successfully after configmaps
modified” pins it.
On 1.37.0, after the third edit, the three values disagreed:
kubectl exec consumer -- sh -c 'echo "env=$GREETING sub=$(cat /etc/sub/greeting) vol=$(cat /etc/cfg/greeting)"'
env=v1 sub=v1 vol=v4
Then only the container was stopped, with crictl stop on the node, not the
pod. The kubelet started a new container in the same pod:
kubectl get pod consumer
kubectl exec consumer -- sh -c 'echo "env=$GREETING sub=$(cat /etc/sub/greeting) vol=$(cat /etc/cfg/greeting)"'
NAME READY STATUS RESTARTS AGE
consumer 1/1 Running 1 (1s ago) 8m57s
env=v4 sub=v4 vol=v4
Same pod, new values in both. The mount table now points at
..2026_09_30_07_59_07.2218838844/greeting, without //deleted. The 1.36.1
run gave the same result.
This has an unpleasant consequence. In a Deployment consuming config through env vars, a replica whose container is restarted by a liveness probe or an OOM kill comes back with the new value, while its healthy siblings keep the old one. After a ConfigMap edit, “all replicas run the same config” stops being true the first time any of them crashes.
Immutable ConfigMaps
immutable: true removes the question. The edit is refused:
kubectl patch configmap frozen-config --type merge -p '{"data":{"greeting":"v2"}}'
kubectl patch configmap frozen-config --type merge -p '{"immutable":false}'
The ConfigMap "frozen-config" is invalid: data: Forbidden: field is immutable when `immutable` is set
The ConfigMap "frozen-config" is invalid: immutable: Forbidden: field is immutable when `immutable` is set
The kubelet knows it too: the first time the watch-based cache returns an
immutable object, it stops that object’s reflector
(pkg/kubelet/util/manager/watch_based_manager.go line 349), which is the
point of the feature on large clusters. The only way to change the data is a
new ConfigMap, and a rollout that points at it.
Getting new config to the pods
Mounted volume, application re-reads files. Nothing to do but wait up to about 90 seconds. To make it immediate, change anything on the pod. The task page says “You can trigger an immediate refresh by updating one of the pod’s annotations,” and it works because a pod update triggers a sync:
kubectl patch configmap app-config --type merge -p '{"data":{"greeting":"v5"}}'
kubectl annotate pod consumer poke="$(date +%s)" --overwrite
Edited at 07:53:55, vol=v5 at 07:53:56. Done twice, one second both times,
while a second pod mounting the same ConfigMap and not annotated was still on
the old value.
Env vars, subPath, or an application that reads its config once at
start. Replace the pods. kubectl rollout restart does it by writing the
current time into the pod template, which changes the template and starts an
ordinary rolling update:
kubectl rollout restart deployment/fleet
kubectl get deployment fleet -o jsonpath='{.spec.template.metadata.annotations}{"\n"}'
deployment.apps/fleet restarted
{"kubectl.kubernetes.io/restartedAt":"2026-09-30T09:02:51+01:00"}
The annotation is set by kubectl itself
(staging/src/k8s.io/kubectl/pkg/polymorphichelpers/objectrestarter.go line 51
on both branches), in the local time of the machine running kubectl. Because it
is a template change, it also creates a new revision; what that does to your
rollout history is covered in
what CHANGE-CAUSE is really showing you.
Tie the rollout to the content. A restart you have to remember is a restart someone forgets. Two common ways to make a ConfigMap change roll the pods by itself:
- Helm’s Automatically Roll Deployments
pattern puts a hash of the rendered ConfigMap into a pod template annotation:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}. New content, new hash, new template, rollout. - Kustomize’s
configMapGeneratorappends a content hash to the ConfigMap’s name and rewrites every reference to it. Changinggreeting=v1togreeting=v2inkustomization.yamlchanged the generated name fromapp-config-8gd54fg664toapp-config-cmkkh96tft, in both the ConfigMap and the Deployment’sconfigMapRef. Applying both versions withkubectl apply -kleft both ConfigMaps in the namespace, so pods from the previous ReplicaSet keep a consistent view while the rollout runs (and the old ones need pruning eventually).
There are also controllers you install in the cluster that watch ConfigMaps and Secrets and patch the workloads that reference them. They work the same way underneath: they change the pod template.
If a rollout then leaves pods stuck, it is usually the ConfigMap rather than
the rollout: a missing key referenced from env stops the container with
CreateContainerConfigError, and a missing
ConfigMap mounted as a volume holds the pod in
ContainerCreating.
Preventing it
- Decide per setting whether it may change at runtime. Anything the
application reads once at start belongs behind a rollout (checksum
annotation or generated name). Anything it genuinely reloads belongs in a
mounted volume without
subPath. - Do not use
subPathfor config you expect to update. If the application needs one file at a fixed path, mount the volume in a directory and point the application at it, or useitemsto project only that key. - Watch the directory, not the file, and treat
..dataappearing as the reload signal. Test the reload in a real pod: a file watcher that works on a laptop fails silently here. - Budget 90 seconds, not “immediately”. Anything that edits a ConfigMap and then checks the result (a CI step, a smoke test) needs to wait out a sync or annotate the pod.
- After any config change, check container start times against the ConfigMap’s last write. That is the only reliable way to know which pods are running what.
Which pods started before the config they use last changed, and whether they read it through env or a volume, is on the pod's Configuration section. KubeGlance is a native Kubernetes client for iPhone and iPad, with a full Mac app on the same core, reading straight from your kubeconfig.
Get KubeGlanceThe Kubernetes dashboard that fits in your pocket
KubeGlance is a native Kubernetes client for iPhone and iPad — the real dashboard, not a companion — with a full Mac app on the same core. Pods, workloads, logs and events, straight from your kubeconfig.
Download KubeGlanceChoosing a Kubernetes client? Compare KubeGlance with Lens, k9s, Headlamp and Aptakube, or see the Mac and iPhone options.


