Skip to content

Scaling up

Course: Kubernetes Part 3 (Scaling) - chapter 5

Before we load test, add some resource limits to your pods. We’re doing this to get around this error - https://github.com/kubernetes-sigs/metrics-server/issues/237

apiVersion: apps/v1
kind: Deployment
metadata:
name: cpu-deployment
spec:
replicas: 2
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:
requests:
cpu: "100m"
limits:
cpu: "1000m"
  • Try sending a bunch of requests to the server (or just visit it in the browser)
npm i -g loadtest
loadtest -c 10 --rps 200 http://65.20.89.70
  • Check the CPU usage
kubectl top pods
  • See the hpa average usage
kubectl get hpa
  • Check the number of pods, see as they scale up
kubectl get pods