overexchange
overexchange

Reputation: 1

Kubernetes - when to use HorizontalPodAutoscaler resource type?

As mentioned in this answer: allow for easy updating of a Replica Set as well as the ability to roll back to a previous deployment.

So, kind: Deployment scales replicasets, which scales Pods, supports zero-downtime updates by creating and destroying replicasets


What is the purpose of HorizontalPodAutoscaler resource type?

apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
  name: xyz
spec:
  maxReplicas: 4
  minReplicas: 2
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: xyz
  targetCPUUtilizationPercentage: 70

Upvotes: 0

Views: 65

Answers (1)

Jonas
Jonas

Reputation: 129065

As you write, with a Deployment it is easy to manually scale an app horizontally, by changing the numer of replicas.

By using a HorizontalPodAutoscaler, you can automate the horizontal scaling by e.g. configuring some metric thresholds, therefore the name autoscaler.

Upvotes: 1

Related Questions