﻿# Keep topology-spread selectors aligned during a rollout

Choose whether spreading counts the whole fleet or one revision, and verify the effective selector on new Pods.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/guide-ks-spread-label-change/
Language: en

A rolling update distributes new model replicas unevenly even though the old revision was balanced. The topology selector may count both revisions when the intended policy was to spread each revision independently. Decide which population the rule should balance before changing the skew limit.

## Define the counted population

The spread constraint's labelSelector identifies existing Pods counted for each domain. A stable application label can include old and new revisions together. That is valid if the goal is balance across the combined fleet. It is a different policy from balancing only the incoming revision, and neither should be inferred from a dashboard that hides revision labels.

## Bind a revision deliberately

Supported clusters provide matchLabelKeys to combine selected values from the incoming Pod's labels with the spread selector. A Deployment's pod-template-hash can distinguish revisions without manually editing the rule for every rollout. Check installed-version and feature support, including the current selector-merge behavior. Do not assume all cluster versions materialize the selection identically.

## Avoid mutable selection inputs

Directly changing a Pod label used by matchLabelKeys is not a reliable way to update the merged selection. The documented behavior warns that such edits need not be reflected. Use controller-created revision identity and the intended Pod template workflow. Otherwise the visible label and effective counted population can diverge during diagnosis.

## Test old and new Pods together

Build a synthetic fixture containing both revisions across the intended topology domains. Compare a combined-fleet selector with a revision-specific selector while holding resource requests constant. Check actual incoming Pod labels, effective constraints and matching existing counts. A test containing only one revision cannot reveal the distinction that causes the rollout surprise.

## Preserve resource and availability limits

Revision-specific spreading can require placements the combined fleet did not need. Available GPU capacity, taints and other hard rules still apply. Acceptance means the scheduler counts the intended population and the resulting distribution matches the chosen policy. It does not guarantee spare rollout capacity or prove that each named domain is independent infrastructure. Keep the selector decision explicit in the rollout design.

## Primary references

[Pod Topology Spread Constraints](https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/).

[Kubernetes Deployments](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/).

[Labels and Selectors](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/).

Related reading: [GPU Deployment rollout stuck: maxSurge without spare capacity](/journal/kubernetes-gpu-rollout-surge-deadlock/); [Updating an LLM on a GPU: testing a new version with a small rollout](/journal/model-update-canary/).
