Skip to content

Demo app for testing liveness and readiness probes in minikube

License

Notifications You must be signed in to change notification settings

mfvanek/minikube-demo

Repository files navigation

Demo app for testing Liveness and Readiness Probes in minikube

See https://cloud.redhat.com/blog/liveness-and-readiness-probes

Custom readiness probe

curl -X GET https://localhost:8090/actuator/health
curl -X GET https://localhost:8080/readyz

Set custom delay for health check response

curl -X PUT https://localhost:8080/delay -H "Content-Type: application/json" -d '{"newDelayInSeconds": 2}'

Custom workload endpoint

curl -X GET "https://localhost:8080/api/v1/workload/now?delay=10"

Run Gatling

./gradlew gatlingRun

Or with custom params:

./gradlew gatlingRun -Drps=2 -DdurationSec=15 -DhostName=https://localhost:8080

Build docker image

With curl

./gradlew dockerBuildImage

Lightweight image

./gradlew bootBuildImage --imageName=io.github.mfvanek/minikube-demo:0.0.1

Run in Docker

docker run --name minikube-demo -d -p 8080:8080 -t io.github.mfvanek/minikube-demo:latest

Show logs

docker logs minikube-demo

Remove container

docker rm -f minikube-demo

Prepare minikube

https://minikube.sigs.k8s.io/docs/start/

Config

minikube config view
minikube config set memory 10000
minikube config set cpus 5
minikube config set driver docker

Start

minikube start --force --extra-config=kubelet.cgroup-driver=systemd --container-runtime=docker
minikube status

Clean

minikube delete --all
minikube delete --all --purge

Dashboard

minikube dashboard

Load image to minikube

minikube image load io.github.mfvanek/minikube-demo:0.2.2
minikube image ls --format table

Run pod

minikube kubectl -- run minikube-demo --image=io.github.mfvanek/minikube-demo:0.0.1 --port=8080 --image-pull-policy Never
minikube kubectl -- get pods
minikube kubectl -- delete pod minikube-demo

Get pod details

minikube kubectl -- get pods
minikube kubectl get endpoints
minikube kubectl describe svc minikube-demo-service

Deploy to minikube

minikube kubectl -- create -f k8s-deployment.yaml
minikube kubectl -- apply -f k8s-deployment.yaml

Expose service

minikube service minikube-demo-service --url