Kubernetes Deployment Generator

Build a Deployment and see the capacity envelope your rollout settings actually produce, drawn to scale. The output is checked by our own validator as you type.

Workload
Rollout

How replacing pods behaves during a deploy. These are the fields that decide whether a deploy is invisible or an outage.

Adds a topologySpreadConstraint. Without one the scheduler may put every replica in one zone.

Resources

deployment.yaml

updates as you type

    Common mistakes

    These are the ones that fail silently. The config is accepted, nothing raises an error, and the consequence arrives later.

    1. Leaving the default rolling update strategy on a small deployment

      25% of 2 replicas rounds to 1, so half the capacity can be gone during a rollout.

      Instead:Set maxUnavailable to 0 with maxSurge 1 where capacity matters.

    2. Omitting resource requests

      The pod becomes BestEffort, first to be evicted and last for CPU under contention.

      Instead:Set requests at minimum. That alone moves it to Burstable.

    3. Setting replicas in the manifest while an HPA manages it

      They fight: the HPA scales up and the next apply scales back down.

      Instead:Remove replicas from the manifest once an HPA owns it.

    What a Deployment does during a deploy

    A Deployment is a controller that manages ReplicaSets, and a rollout is one ReplicaSet scaling up while another scales down. Everything that goes wrong during a deploy is one of the numbers governing how fast that happens.

    maxSurge and maxUnavailable round in opposite directions

    Both accept a number or a percentage, and the rounding is not symmetric: maxSurge rounds up so there is always a spare slot, maxUnavailable rounds down so the dip is never bigger than asked for. Both directions protect availability, and reading them as the same rule is how 25% on three replicas surprises people.

    replicas: 3, maxSurge: 25%, maxUnavailable: 25%
    
      maxSurge       ceil(0.75) = 1 extra pod
      maxUnavailable floor(0.75) = 0 may be down
    
      so capacity during the deploy: 3 to 4, never below 3
    
    replicas: 10, both 25%
      surge 3, unavailable 2  -> capacity 8 to 13

    spec.selector is immutable, and that is a one-way door

    It is required, and once the Deployment exists it cannot be changed. Adding or renaming a label in the selector means deleting and recreating the Deployment, which means downtime unless you plan around it. This is why the selector should be one stable label, not a copy of every label on the pod.

    selector:
      matchLabels:
        app.kubernetes.io/name: api    <- pick one, keep it
    
    # not this:
    selector:
      matchLabels:
        app: api
        version: v1.2.3    <- now every release needs a
                              delete and recreate

    A failed rollout does not roll back

    progressDeadlineSeconds decides when a stalled rollout is marked Failed. That is all it does. The Deployment sits with both ReplicaSets present, the old pods still serving, and the new ones still crashing, until a person runs kubectl rollout undo. Nothing is automatic, and nothing alerts.

    kubectl rollout status deploy/api
    error: deployment "api" exceeded its progress deadline
    
    kubectl rollout undo deploy/api    # the manual step
    
    # CI that runs `rollout status` and fails the build is
    # what turns this into something you find out about.

    minReadySeconds is what catches a pod that lies

    Without it, a pod counts as available the instant its readiness probe passes once. A container that starts, passes one probe and then crashes still lets the rollout move on to the next pod, so a broken build can roll all the way out. minReadySeconds makes the rollout wait and watch.

    minReadySeconds: 10
    
    # the pod has to stay Ready for 10 seconds before it
    # counts. A crash at t+3 stops the rollout with most
    # of the old ReplicaSet still up and serving.

    Replica count is not availability

    Nothing stops the scheduler placing every replica on one node. Three replicas on one node is one node failure away from zero. A topology spread constraint fixes it, and the strict form leaves pods Pending forever on a single-zone cluster, so ScheduleAnyway is the safer default.

    topologySpreadConstraints:
      - maxSkew: 1
        topologyKey: topology.kubernetes.io/zone
        whenUnsatisfiable: ScheduleAnyway
        labelSelector: {matchLabels: {...}}
    
    # DoNotSchedule is stricter and correct in production
    # across real zones. On a one-zone test cluster it
    # leaves pods Pending with an unhelpful event.