Sometimes you just want one specific node gone.
⚠️ Anti-Pattern Alert!
Yeah, yeah — “cattle, not pets”. In theory you shouldn’t care. In reality, especially in enterprise setups, sometimes you do.
Here’s how to do it properly in a Cluster API (CAPI) cluster without it coming back.
The catch
CAPI is declarative.
If your cluster says:
“I want N nodes”
…it will keep N nodes.
So if you just do:
|
|
It’ll come back.
The rule (don’t skip this)
|
|
Are you using autoscaler?
Quick check:
|
|
Pick your MachineDeployment name, then:
|
|
If you see:
|
|
👉 You’re using Cluster Autoscaler.
Or:
|
|
If you see a cluster-autoscaler pod, same thing.
💡 On platforms like Nutanix Kubernetes Platform, autoscaler is typically enabled.
The flow
flowchart TD
A[Find node] --> B[Find Machine + MachineDeployment]
B --> C[Annotate Machine]
C --> D{Autoscaler?}
D -->|Yes| E[Update min/max]
D -->|No| F[Scale replicas]
Step 1 — Find your node
List nodes:
|
|
Pick the node you want to remove.
Step 2 — Find the Machine and MachineDeployment
Get all Machines:
|
|
Find the Machine that matches your node using:
|
|
To get more details (including owner MachineDeployment):
|
|
Look for:
|
|
Then:
|
|
From there you’ll find the MachineDeployment name.
Step 3 — Annotate the Machine
|
|
This tells CAPI:
“When you scale down, delete this one.”
Step 4 — Reduce capacity
No autoscaler
Scale the MachineDeployment:
|
|
With autoscaler
Update min/max instead:
|
|
If you’re testing this on Nutanix Kubernetes Platform, this is the path you’ll use.
Verify
|
|
TL;DR
|
|
That’s it—no guessing, no missing steps.