Skip to content

Cluster autoscaling

Course: Kubernetes Part 3 (Scaling) - chapter 8

Ref - https://github.com/kubernetes/autoscaler

Cluster Autoscaler - a component that automatically adjusts the size of a Kubernetes Cluster so that all pods have a place to run and there are no unneeded nodes. Supports several public cloud providers. Version 1.0 (GA) was released with kubernetes 1.8.

In the last slide, we saw that we didn’t have enough resources to schedule a pod on.

Let’s make our node pool dynamic and add a min and max nodes.

kubectl delete deployment cpu-deployment
kubectl apply -f deployment.yml

Notice a new node gets deployed

kubectl get pods -n kube-system | grep cluster-autoscaler

apiVersion: apps/v1
kind: Deployment
metadata:
name: cpu-deployment
spec:
replicas: 10
selector:
matchLabels:
app: cpu-app
template:
metadata:
labels:
app: cpu-app
spec:
containers:
- name: cpu-app
image: 100xdevs/week-28:latest
ports:
- containerPort: 3000
resources:
limits:
cpu: "1000m"
requests:
cpu: "1000m"

Notice the number of server goes down to 2 again

  1. Gitops (ArgoCD)
  2. Custom metrics based scaling, event based autoscaling - https://www.giffgaff.io/tech/event-driven-autoscaling
  3. Deploying prometheus in a k8s cluster, scaling based on custom metrics from prometheus