Most autoscaling problems are loud. The HPA flaps, metrics-server falls over, a stabilization window keeps pods around too long. You see those on a dashboard.
The two I want to write about are quiet. Nothing fails. The Deployment is healthy, the HPA or ScaledObject looked fine yesterday, and the pod count just stops moving. Both come from ordinary deploy changes. Both are documented, just not anywhere you'd look while reviewing a PR.
1. A replica count of 0 switches the HPA off
The Kubernetes HPA docs have a short section called "Implicit maintenance-mode deactivation". If the target's desired replica count is set to 0 and the HPA's minReplicas is above 0, the HPA stops adjusting the target. It sets its own ScalingActive condition to False and stays that way until someone changes the replica count or minReplicas by hand.
That's on purpose. It lets you park a workload without deleting its HPA. The trouble is how easy it is to trigger by accident. Someone runs kubectl scale --replicas=0 during an incident and never scales back. Or a replicas: 0 meant for a switched-off environment ends up in a values file that production also reads.
The same docs page has a related warning. If spec.replicas stays in the manifest while an HPA is active, every kubectl apply scales the Pods back to that number. With a normal number you get thrashing. With 0, every sync parks the workload again and the HPA steps aside.
kubectl get hpa still lists the HPA, so nothing looks wrong at a glance. You have to read the conditions.
Checking by hand
All of these are read-only. To list HPAs whose ScalingActive condition is False:
kubectl get hpa -A -o json | jq -r '.items[] | select(any(.status.conditions[]?; .type=="ScalingActive" and .status=="False")) | "\(.metadata.namespace)/\(.metadata.name)"' A metrics problem can also set that condition to False, so run kubectl describe hpa <name> -n <namespace> and read the reason and message before you change anything.
To list Deployments currently at 0:
kubectl get deploy -A -o json | jq -r '.items[] | select(.spec.replicas==0) | "\(.metadata.namespace)/\(.metadata.name)"' And to find where a 0 comes from in your manifests or Helm values:
grep -rnE '^\s*replicas:\s*0\b' . What to do about it
First decide whether the workload was meant to be parked. If it wasn't, the docs say to reactivate it by changing the target's replica count or the HPA's minReplicas by hand, so scale it back to a number at or above minReplicas.
Then take spec.replicas out of the manifest for anything an HPA manages. Follow the docs' migration steps when you do it. Removing the field can drop you to 1 pod for a moment, because 1 is the default. Running kubectl apply edit-last-applied first avoids that with client-side apply. With server-side apply, you transfer ownership of the field instead.
2. Deleting a KEDA ScaledObject keeps whatever count you had
KEDA's ScaledObject has a setting called advanced.restoreToOriginalReplicaCount, and it defaults to false. The KEDA docs (2.21 is the latest release listed) say that by default, deleting the ScaledObject leaves the target at the replica count it had at that moment.
KEDA's minReplicaCount also defaults to 0. Picture a queue worker that scaled to zero overnight. Someone deletes its ScaledObject in the morning, maybe in a cleanup PR, maybe because a Helm flag stopped rendering the template, maybe through an Argo CD prune. The Deployment stays at 0. There's no HPA or ScaledObject left to bring it back, and nothing errors. The queue just keeps growing.
It works the other way too. Delete the ScaledObject in the middle of a spike and the Deployment keeps all those pods until someone notices.
Checking by hand
To list ScaledObjects that won't restore the original count when they're deleted:
kubectl get scaledobjects -A -o json | jq -r '.items[] | select(.spec.advanced.restoreToOriginalReplicaCount != true) | "\(.metadata.namespace)/\(.metadata.name) -> \(.spec.scaleTargetRef.name)"' After a deploy that removed one, run the Deployments-at-0 command from above and compare it with the targets still listed here. A Deployment at 0 that nothing scales is the one to look at.
What to do about it
If you're taking autoscaling off a workload, pick one of two options. You can set restoreToOriginalReplicaCount: true in its own change, so the setting is already on the ScaledObject when it gets deleted. Or you can put an explicit replicas value on the Deployment in the same PR that removes the ScaledObject, so the count is something you chose.
What to look for in review
Both show up in a plain diff. One is a replicas: 0 on a workload that also has an HPA or ScaledObject. The other is a ScaledObject being deleted while restoreToOriginalReplicaCount is unset. Neither one looks risky when you're reading it, and both will pass review.