Attach a HorizontalPodAutoscaler to a Deployment
A 3-step recipe with Kubernetes. We can help you get access.
Recipe · 3 steps
Attach a HorizontalPodAutoscaler to a Deployment
with Kubernetes
Create a HorizontalPodAutoscaler bound to an existing deployment.
- Read the deployment the HPA will target. An HPA pointing at a non-existent target is created successfully but never scales anything.
- Create the HorizontalPodAutoscaler bound to the deployment by scaleTargetRef, with the supplied replica floor and ceiling.
- List the namespace's autoscalers to confirm the HPA is registered and to report the replica counts the controller has computed so far.
What you'll need to have ready
- namespace: The namespace containing the deployment and the new HPA.
- deploymentName: The deployment the autoscaler will scale.
- hpaName: Name for the HorizontalPodAutoscaler resource.
- minReplicas: Minimum replica count the autoscaler may scale down to.
- maxReplicas: Maximum replica count the autoscaler may scale up to.
For your developer
Arazzo workflow kubernetes:autoscale-deployment, 3 operations: getNamespacedDeployment → createNamespacedHorizontalPodAutoscaler → listNamespacedHorizontalPodAutoscalers. Specs on APIs.io.