market-web in vitals-fa07gq has one replica with a CPU request of 100m and a Service in front of it. Put an autoscaler on it:
sh
kubectl autoscale deployment market-web -n vitals-fa07gq --min=1 --max=5 --cpu-percent=50
kubectl get hpa -n vitals-fa07gqWait a few seconds until TARGETS shows a percentage. Then start a load generator that fetches the page in a loop:
sh
kubectl apply -n vitals-fa07gq -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
name: load
spec:
containers:
- name: load
image: busybox
command: ["sh", "-c", "while true; do wget -q -O- http://market-web; done"]
EOFWatch for about half a minute:
sh
kubectl get hpa,deploy -n vitals-fa07gq
kubectl top pods -n vitals-fa07gqWhen the replica count has settled, delete the load Pod. The HPA scales down about a minute later.