The Spread Constraint That Lets a Stateless 5G Core Lose Its State
A stateless SMF is only as stateless as the session store behind it. The line that most often breaks that promise is whenUnsatisfiable: ScheduleAnyway on the store's topology spread constraint. It passes review because it is valid, it reads like caution, and on the day it was merged the scheduler spread the replicas anyway. Months later a node drain or an autoscaler consolidation packs those replicas into one zone, and nobody notices until that zone goes away.
Why the diff looks correct
Kubernetes treats ScheduleAnyway as a soft preference. The scheduler scores zones by skew, but when the ideal zone is short on capacity it places the pod wherever it fits. On a fresh cluster with headroom in every zone, the result looks exactly like the hard DoNotSchedule variant, so every test environment and every staging soak shows the replicas spread neatly with a maxSkew of 1 pod per zone. The drift comes later and silently, through rolling upgrades, spot reclamation, or a cluster autoscaler that removes underused nodes and reschedules their pods onto whatever capacity is left. Nothing moves them back, because the default scheduler never relocates a running pod and core clusters rarely run a descheduler. Reviewers check the YAML against its intent, and the intent is right. What they cannot see is the placement the YAML allows under pressure.
What actually fails
When the zone holding most of the UDSF or Redis replicas drops, the store loses quorum and becomes read-only or unavailable. Meanwhile every SMF and AMF pod in the surviving zones keeps passing its readiness probe. Those pods are healthy by every local measure, so the NRF keeps advertising them and consumers keep sending them traffic. Every request that needs session context then fails on the state lookup. That cascades into PDU session releases, UE re-registrations and an N4 re-establishment storm aimed at UPFs that still hold the old sessions. The 3GPP service-based architecture specs move NF context into an unstructured data store precisely so compute can fail independently, but that separation only works if the store keeps its own failure domains apart. On a mid-size deployment the re-attach wave can take several minutes to settle (an estimate that depends heavily on AMF overload control settings), which is longer than most zone outages last.
A check you can run before the next drain
Render the charts exactly as you deploy them, run helm template./charts/core | grep ScheduleAnyway, and judge every hit by one rule: any workload that holds quorum or session state gets DoNotSchedule, and ScheduleAnyway is allowed only where losing a zone costs capacity rather than correctness. That check catches bad intent but not drift, so pair it with a live placement check. List each state store pod's spec.nodeName, look up that node's topology.kubernetes.io/zone label, and count pods per zone. If any single zone holds enough replicas to break quorum by itself, the incident is already sitting in your cluster and has simply not happened yet. Run the first check in CI and the second as a nightly job: the first stops new mistakes, and only the second sees the cluster as it actually is today.
The cost of the hard constraint
With DoNotSchedule, a zone short on capacity leaves state store pods Pending instead of packing them elsewhere, so the next decision is whether to size each zone with enough headroom to absorb a full drain, or to accept a reduced replica count as the price of never stacking quorum in one place.
Technical FAQ: Should the SMF readiness probe also check the state store?
Only partially. If every SMF pod fails readiness when the store degrades, the NRF drops the whole fleet at once and a state outage becomes a total outage. Have the probe check store reachability from the pod's own zone, and leave quorum loss to a separate alert instead of readiness.