How a ConfigMap Edit Reached Only Four of Eight Pods and Made Payment Timeouts Look Random
← Back
November 24, 2026Kubernetes8 min read

How a ConfigMap Edit Reached Only Four of Eight Pods and Made Payment Timeouts Look Random

Published November 24, 20268 min read

16:48 IST, Thursday. Sentry: PaymentGatewayTimeout, 61 events in ten minutes. Tuesday we raised the timeout to 20 seconds precisely so this alert would stop firing. It is firing again.


the scramble

Three of us in the incident channel. Support has already forwarded two customers whose card was charged but whose order shows "payment pending". The payment provider's status page is green.

First theory: the provider is degraded for our merchant account only. Somebody opens a ticket with them. Second theory: our change on Tuesday did not work. That one gets dismissed fast, because I made the change myself and I remember the output:

$ kubectl apply -f configmap-orders-api.yaml configmap/orders-api-config configured

The ConfigMap holds PAYMENT_TIMEOUT_MS. It went from 8000 to 20000 on Tuesday at 11:05. The provider's p99 for 3DS-challenge payments is about 14 seconds, so 8 seconds was never going to work for those. I said "configured" out loud in standup.

the hunt

Dead end one: the provider. I pull our own client-side latency histogram for the last 24 hours. The provider's p99 is 13.2 seconds, p999 is 17.8. Nothing is above 20. If the timeout were really 20 seconds, none of these 61 events could have happened.

Dead end two: the client library. Maybe it ignores the env var and has its own default. I read the wrapper in payments/client.py:

PAYMENT_TIMEOUT_S = int(os.environ.get("PAYMENT_TIMEOUT_MS", "8000")) / 1000 client = httpx.AsyncClient(timeout=httpx.Timeout(PAYMENT_TIMEOUT_S, connect=3.0))

It reads the variable once, at import time. Normal enough, so not the bug by itself, but it matters in a minute.

Dead end three: the deploy. Maybe Tuesday's apply was overwritten by CI re-applying an old manifest. I check the ConfigMap in the cluster:

$ kubectl get cm orders-api-config -o jsonpath='{.data.PAYMENT_TIMEOUT_MS}' 20000

The cluster says 20000. The manifest in git says 20000. So the config is right and the errors still look like an 8 second cutoff. I group the Sentry events by the pod tag, which is something I should have done in the first five minutes:

orders-api-7d9c5b6f4-2kq8x 0 orders-api-7d9c5b6f4-5vtn2 23 orders-api-7d9c5b6f4-9hcr6 0 orders-api-7d9c5b6f4-bw4zl 19 orders-api-7d9c5b6f4-jx7m8 0 orders-api-7d9c5b6f4-pl2dd 0 orders-api-7d9c5b6f4-t6s9w 14 orders-api-7d9c5b6f4-xk5fh 5

Eight pods, one ReplicaSet hash, and the errors are on only four of them. Same image, same config, different behavior. This is where the incident stopped being about the payment provider.

I exec into one erroring pod and one clean pod and print the variable:

$ kubectl exec orders-api-7d9c5b6f4-5vtn2 -- printenv PAYMENT_TIMEOUT_MS 8000 $ kubectl exec orders-api-7d9c5b6f4-2kq8x -- printenv PAYMENT_TIMEOUT_MS 20000

Same ConfigMap, two different answers. I run the same check on all eight. Four pods have 8000 and four have 20000. They match the four pods that threw errors.

the find

The deployment injects the value like this:

envFrom: - configMapRef: name: orders-api-config

Environment variables built from a ConfigMap are resolved when the container is created. Kubernetes does not update them in a running container. It does update ConfigMaps mounted as volumes, eventually, but that is a different mechanism and our code reads the env var, not a file. So on Tuesday at 11:05 nothing happened to any running pod. The pods that happened to start after that moment got 20000. The rest kept 8000.

Which pods restarted after 11:05? I check the start times:

$ kubectl get pods -l app=orders-api \ -o custom-columns=NAME:.metadata.name,START:.status.startTime

Four pods started on Wednesday at 02:10. That was the node pool upgrade our platform team ran, which drained two nodes and rescheduled everything on them. Those four picked up the new value by accident. The other four had been running since the previous Friday's deploy. Nobody had touched them, and the deployment spec had not changed, so Kubernetes had no reason to roll them.

Tuesday and Wednesday had few 3DS-challenge payments, so the errors stayed under the alert threshold. Thursday afternoon is campaign traffic with more first-time cards. Load balancing across eight pods meant roughly half of the slow payments landed on an 8 second pod. So it looked random. My "configured" output had felt like proof, but configured only means the API object changed.

the fix

Immediate: kubectl rollout restart deployment/orders-api at 17:31. Rolling update, 8 pods, maxUnavailable 1. By 17:44 every pod printed 20000 and the error rate went to zero.

Permanent: make a config change a deployment change. We use Helm, so the standard trick is a checksum annotation on the pod template. When the ConfigMap content changes, the annotation changes, the pod template changes, and the Deployment controller rolls the pods.

spec: template: metadata: annotations: checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}

For the two services that are not in Helm, we installed Stakater Reloader and added reloader.stakater.com/auto: "true" to the Deployment. Either works, and neither depends on someone remembering to restart.

We also added a small drift check to the app itself. On startup it logs the effective timeout, and a /health/config endpoint returns the resolved values with a hash, so a script can compare pods against the ConfigMap:

@router.get("/health/config") def config_fingerprint(): effective = {"payment_timeout_ms": int(PAYMENT_TIMEOUT_S * 1000)} digest = hashlib.sha256(json.dumps(effective, sort_keys=True).encode()).hexdigest()[:12] return {"values": effective, "hash": digest}

the aftermath

The window ran from Tuesday 11:05 to Thursday 17:44, about 54 hours. Only the Thursday afternoon traffic crossed the alert line, but across the whole window 212 payments timed out client-side on the 8 second pods. Of those, 37 were charged by the provider without the order being marked paid, and support reconciled them by hand that evening. Nobody was double charged, but 37 customers saw "payment pending" for up to six hours.

What changed afterward:

  • Every Helm chart for a service that reads config from env vars now has the checksum annotation. A CI check greps the chart templates and fails if a Deployment uses envFrom without it.
  • A scheduled job hits /health/config on every pod and pages if more than one hash is present for a single Deployment for over ten minutes.
  • The runbook for config changes no longer says "apply the ConfigMap". It says "apply, then confirm a rollout happened, then compare the pod hashes".
  • Sentry alerts for this service are now grouped by pod as well as by error, so a skewed error distribution is visible on the first look.

What I took from it: configured is the API server telling you it stored your object, not that anything running has seen it. When identical pods behave differently, compare them before forming a theory about the dependency.

Share this
← All Posts8 min read