Rancher UI node selector vs kubectl Pod Topology Spread Constraints for multi‑zone workloads
0 reputation · 08 Dec 2025, 22:28 UTC
0 reputation · 08 Dec 2025, 22:28 UTC
The Rancher UI offers a quick path to deploy workloads, exposing only a basic node selector. When a cluster spans multiple availability zones, the UI cannot express the full Pod Topology Spread Constraints required for even distribution and high availability.
Direct application of manifests via kubectl or a GitOps workflow allows explicit topology constraints, but introduces a separate management surface and the risk of configuration drift if UI changes are not mirrored in the source of truth.
What decision factors should influence the choice between the UI’s simplified node selector and the granular scheduling available in raw manifests? How can teams ensure that changes made through the UI are reflected in the underlying GitOps source to avoid drift? Are there documented limitations that prevent the UI from preserving custom scheduling fields when using the Edit as YAML feature?
30275 reputation · 09 Dec 2025, 03:19 UTC
If the workload must spread evenly across availability zones, the Rancher UI's node selector is the wrong tool regardless of convenience: a node selector can only pin pods to labeled nodes, it cannot express distribution. Multi-zone high availability requires topologySpreadConstraints, which the Rancher workload form does not expose — so the manifest (via kubectl or GitOps) becomes your authoring surface. The UI is acceptable only for single-zone or placement-tolerant workloads.
A node selector such as topology.kubernetes.io/zone: us-east-1a forces all replicas into one zone — the opposite of HA. Spreading requires constraints like:
topologySpreadConstraints:
- maxSkew: 1
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
app: my-app
Use whenUnsatisfiable: DoNotSchedule for strict guarantees, but note the trade-off: during a zone outage, remaining zones may be unable to satisfy maxSkew, leaving pods Pending. ScheduleAnyway degrades gracefully to best-effort spreading.
The risky pattern is mixing surfaces: hand-author YAML with topology constraints, then have someone later edit the workload through the Rancher form UI. Fields the form does not model can be dropped on save. "Edit as YAML" generally preserves what is already in the spec, but round-trip behavior varies by Rancher version — treat this as unverified until you test it on yours:
# 1. Deploy with constraints via YAML
# 2. Open the workload in the Rancher form UI, change something trivial, save
# 3. Diff the result
kubectl get deploy my-app -o yaml | grep -A6 topologySpreadConstraints
If the constraints vanish, that confirms form edits are lossy on your version and the form UI must be off-limits for that workload.
The reliable answer is to not sync at all — pick one source of truth:
Server-side apply (kubectl apply --server-side) surfaces field-ownership conflicts when multiple actors manage one object, but it detects collisions rather than preventing them — discipline still matters.
topology.kubernetes.io/zone labels are auto-populated by cloud-integrated providers; on bare metal you must label nodes yourself. Verify with kubectl get nodes --show-labels.kubectl get pods -o wide grouped by node/zone should match your intended maxSkew.Version note: Rancher's YAML round-trip behavior and UI field coverage change between releases; the diff test above is the dependable check for your environment.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.