> k3d create --name "test" --publish "80:80" --api-port 6443 --workers 2
> export KUBECONFIG="$(k3d get-kubeconfig --name='test')"
> kubectl apply -f https://raw.githubusercontent.com/ruanbekker/kubernetesfiles/master/blogpost-demos/k3d-autoscaling/php-apache-cpu-intensive.yml
> kubectl apply -f https://raw.githubusercontent.com/ruanbekker/kubernetesfiles/master/blogpost-demos/k3d-autoscaling/hpa.yml
> kubectl get hpa
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
php-apache Deployment/php-apache 0%/50% 1 10 1 80s
> kubectl run --generator=run-pod/v1 -it --rm load-generator --image=busybox /bin/sh
while true; do wget -q -O- http://php-apache.default.svc.cluster.local; done
> kubectl get hpa -o wide
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
php-apache Deployment/php-apache 474%/50% 1 10 10 8m27s
> kubectl get deployment -o wide
NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR
php-apache 1/10 10 1 9m9s php-apache ruanbekker/php-cpu-itensive run=php-apache
stop the traffic
> kubectl get hpa -o wide
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
php-apache Deployment/php-apache 0%/50% 1 10 10 9m25s