Kubernetes for developers

Runing kubernetes on local

  • Docker Desktop | Rancher Desktop | Minikube
  • Install Ingress controller
    helm repo add nginx-stable https://helm.nginx.com/stable
    helm install --namespace nginx-ingress --create-namespace nginx-ingress nginx-stable/nginx-ingress
    
  • Install Prometheus Stack
  • Install metric server https://artifacthub.io/packages/helm/metrics-server/metrics-server
    helm repo add metrics-server https://kubernetes-sigs.github.io/metrics-server/
    helm upgrade --install metrics-server metrics-server/metrics-server --namespace metrics-server --create-namespace --atomic --wait -f deploy/metrics-server/heml-values.yaml

KEDA

helm repo add kedacore https://kedacore.github.io/charts
helm install keda kedacore/keda --namespace keda --create-namespace

Conecting to the kubernetes cluster

Build Docker image

docker build -t rsciriano/k8s-minimal-web:v2

Deploy with helm

https://github.com/bitnami/charts/tree/main/bitnami/aspnet-core

helm upgrade --install -f deploy/rob-demo/helm-values-00-base.yaml \
--namespace rob-demo --create-namespace \
--atomic --wait --debug \
rob-demo bitnami/aspnet-core \
-f deploy/rob-demo/helm-values-02-autoscaling.yaml 
helm upgrade --install -f deploy/crappy-api/helm-values-00-base.yaml \
--namespace rob-demo --create-namespace \
--atomic --wait --debug \
crappy-api bitnami/aspnet-core 

Load testing

hey -c 200 -z 3m http://kubernetes.docker.internal/rob-demo
brew install wrk

k6

export PATH=$(go env GOPATH)/bin:$PATH
xk6 build --with github.com/szkiba/xk6-dashboard@latest
./k6 run --vus 200 --duration 30m --out 'dashboard=ui=http://127.0.0.1:8080/&period=1' script.js

Secrets

kubectl apply -f .secrets/secrets.yaml -n rob-demo

Monitoring

https://github.com/microsoft/ApplicationInsights-Kubernetes

kubectl apply -f deploy/rob-demo/application-insights-sa-role.yml -n rob-demo