I wrote down that two workloads wouldn't fit on one node, then let the scheduler put them there

Last week I spent an afternoon watching a two-node cluster behave like a one-node cluster, and the cause was a sentence I had written myself months earlier and never acted on.

What I shipped

The cluster is a single pool of two small nodes, a little under two allocatable cores each. On it run a controller service and a Postgres database, plus the usual add-ons. I wrote the controller’s manifest with a memory request well under a gigabyte and a limit about two and a half times that, one replica, Recreate strategy, and no affinity, anti-affinity or topology spread of any kind. The database StatefulSet was the same: requests, limits, nothing about placement.

I also wrote the capacity table in the deployment README. It said the add-ons take about 1.3 cores of a node, the application workloads about 0.45, that running a remote command against the cluster needs another 0.2 “which one node has no room for”, and that the database “may use 2.5GiB, the most of any workload”. The architecture page described the cluster and the volumes and said nothing about where each workload runs relative to the others.

So the documentation knew the fit was marginal. The manifests didn’t.

What happened

The scheduler did exactly what I’d told it it could do and put the controller and the database on the same node. That node sat at 100% CPU and over 100% memory, with the two processes splitting the cores roughly evenly between them, while the other node idled at 6% CPU.

The two processes then fed on each other’s starvation. Postgres being slow made the controller’s writer slow. The writer’s backlog grew the controller’s heap. The controller’s extra work competed with Postgres for the same two cores. Nothing was crashing, so nothing restarted; it just got steadily worse.

The fix was a live patch adding a required anti-affinity between the two, which cost about thirty seconds of downtime while the controller was rescheduled. After it the nodes sat at 54% and 77%, foreground writes dropped to under a second, and the API went back to consistent sub-second responses. The hardware was fine the whole time. I had just arranged for half of it to be unused.

What I got wrong

I treated placement as the scheduler’s problem. Each of these two workloads needs most of a node of this size. On a two-node pool, “most of a node” times two is “a node each”, and that’s a design decision, not something to leave to a bin-packer. The architecture doc should have said it, and the manifests should have enforced it.

I sized requests to the steady state, not the working set. The controller’s request was well under a gigabyte; its measured resident set was around two. The database’s request was about a gigabyte; it was documented as using two and a half. From the scheduler’s perspective those two fit comfortably side by side. A request far below a workload’s measured peak isn’t a conservative number, it’s a false statement to the scheduler, and the scheduler will believe it.

I wrote the conclusion in prose and then didn’t read it. “One node has no room for” something is a placement rule. It was sitting in a README as a note instead of in a manifest as a constraint. Documentation that says what the manifests should say, but which the manifests don’t say, is the worst kind: it looks like the thinking has been done.

What it should have looked like

  • The architecture page states placement where placement matters: the controller and the database each run on their own node, because each needs most of one.
  • The manifests carry a required anti-affinity between them, not a preferred one. On a two-node pool a preference can still co-locate them. The usual argument against required rules — they block node upgrades — doesn’t apply here, because the managed upgrade brings up a surge node, so there’s always somewhere for the evicted pod to go.
  • The local single-node overlay relaxes the rule so the dev loop still schedules. Required in the real cluster, relaxed locally, explicitly.
  • Requests sized to the measured peak, reviewed in the same pass that sets the limit. If the request and the limit are far apart, that gap should be a conscious decision with a reason, not a default.

The check I’m adding

For any cluster with a small fixed node count: list every workload whose measured CPU or memory exceeds half a node. Any two of those sharing a node is a failure mode, and the manifests have to say they’re kept apart. Then compare each request against the measured peak; anything well below it is a scheduling lie and needs either a bigger request or a written justification. And any time a README says a node “has no room” for something, that sentence gets turned into a constraint the scheduler can read, or deleted, because leaving it as prose is how it was true and useless at the same time.

Advanced search: filter by model or tag