Skip to content
shiporbreak

No streak yet

Sign in

November 5, 2026 路 #50

KubernetesMediumOpen write-up

502s on every rollout

Every deploy causes about 30 seconds of 502s while the app warms up. What is missing at the marked spot?

apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
spec:
  replicas: 3
  selector:
    matchLabels:
      app: web
  template:
    metadata:
      labels:
        app: web
    spec:
      containers:
        - name: web
          image: registry.example.com/web:1.42.0
          ports:
            - containerPort: 8080

Next puzzle in UTC

One try. The first answer sticks.

How to fix it

Without a readiness probe, Kubernetes treats a started container as ready. The rollout adds it to the Service and removes an old pod while the new one is still booting.

A rolling update replaces old pods as new ones become Ready. With no readiness probe, Ready means the process started. A JVM or a Rails app can take 20 to 30 seconds after that to open its port, load caches, and connect to the database. During that window the Service routes requests to it, and the ingress returns 502s. Meanwhile the old pods are already terminating.

A readiness probe is different from a liveness probe. Readiness only controls traffic. It never restarts the container.

Fix

          readinessProbe:
            httpGet:
              path: /ready
              port: 8080
            periodSeconds: 5
            failureThreshold: 3

Make /ready return 200 only after the app can serve. Add minReadySeconds and a preStop sleep so endpoints drain before old pods exit.

Sponsor this spot

Put your tool on the puzzle
One labeled card, in front of engineers who show up every day from YouTube, TikTok, and Instagram.