- Docker Desktop (including Kubernetes support)
- For my applications and loadtest I've used Node.js, but you can use any language you want to create your container image and loadtest tool.
- Download latest Docker Desktop and use your license if you need to. You can use Rancher Desktop if you want to as well, that requires no license.
- Enable Kubernetes within Docker Desktop.
- Check
kubectl get pods
-
docker build .\application\ -t localhpatest
-
To test so far: docker run -p 8080:8080 localhpatest:latest
-
kubectl apply -f application\deployment.yml
-
kubectl get pods
-
kubectl apply -f application\service.yml
-
kubectl get services
- kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.2.0/deploy/static/provider/cloud/deploy.yaml
- kubectl apply -f application\ingress.yml
- Change the config, all speaks for itself quite well.
cd loadtest
npm i
node .\index.js > result.txt
-
We need to use 0.4.5, as the 1.24 K8s has some issues with the recent metric-servers.
-
Recent version is here: https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
-
add tls insecurity line 139:
- --kubelet-insecure-tls
-
Optional, if it doesn't work: Change following, local clusters are slow.
- --metric-resolution=30s
-
kubectl apply -f .\metric-server\0.4.5-components.yml
- kubectl apply -f application\hpa.yml
- kubectl describe hpa
- You can start some loadtests, and see your application scale.
I've used parts of the initial setup from the guide by Daniel Trimble: @(https://medium.com/@dstrimble/kubernetes-horizontal-pod-autoscaling-for-local-development-d211e52c309c)