Autoscaling in Kubernetes:
ReplicaSet works with a set number of pods.
Horizontal Pod Autoscaler(HPA) enables scaling up and down as needed
Can configure based on desired state of CPU, memory etc.
Horizontal Pod Autoscaler, or HPA, enables the application to increase the number of pods based on traffic.
The master node will periodically check pod metrics and scale to meet the desired state by updating the replicas field of the scaled resource, such as ReplicaSets or deployment.
$ kubectl apply -f deployment.yaml
$ kubectl get all
$ kubectl get hpa
$ kubectl autoscale deploy nginx-deployment --min=2 --max=5 --cpu-percent=10
"cpu-percent" is the trigger to create new pods. This tells the system, “If the CPU usage hits 10% across the cluster, create a new pod.”
A Horizontal Pod Autoscaler is created behind the scenes to manage the autoscaling feature of the deployment.





0 comments:
Post a Comment