EricSmekens / DevDays2022-k8s-hpa

Example cluster setup, which will walk you through the steps to rollout a HPA deployment, with Docker Desktop (i.e)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Local Kubernetes and HPA Examples - DevDays2022 - CM.com

Prerequisite

  • 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.

Get the cluster running

  • 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

Get our application building and deployed

  • 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

Get Ingress-NGinx ready to make our cluster available from outside the cluster

Loadtest (autocannon example), but you can use K6, JMeter, anything you'd like

  • Change the config, all speaks for itself quite well.
cd loadtest
npm i
node .\index.js > result.txt

Get a Metric-server, so we can autoscale on those metrics

HPA

  • kubectl apply -f application\hpa.yml
  • kubectl describe hpa
  • You can start some loadtests, and see your application scale.

Credits:

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)

About

Example cluster setup, which will walk you through the steps to rollout a HPA deployment, with Docker Desktop (i.e)


Languages

Language:JavaScript 83.6%Language:Dockerfile 16.4%