Setting A Deployment's Replicas And Having A Horizontal Pod Autoscaler
What happens if you set a Kubernetes deployment’s number of desired replicas and have a horizontal pod autoscaler (HPA) for the same deployment?
The short answer is the HPA takes precedence.
The HPA will override the Deployment’s replica count based on the observed metrics and the scaling rules defined in the HPA configuration.
Even if you manually change the replica count in the Deployment, the HPA will eventually adjust it to match the desired target utilization.
Don’t manually modify the deployment’s replica count in the deployment if there’s an HPA controlling it because it can lead to conflicts and strange behavior.
Master GitHub Actions with a Senior Infrastructure Engineer
As a senior staff infrastructure engineer, I share exclusive, behind-the-scenes insights that you won't find anywhere else. Get the strategies and techniques I've used to save companies $500k in CI costs and transform teams with GitOps best practices—delivered straight to your inbox.
Not sure yet? Check out the archive.
Unsubscribe at any time.