Face a Disaster

In this lesson, we will first simulate an issue and try to find out the issue by executing different expressions.

Let’s explore one disaster scenario. Frankly, it’s not going to be a real disaster, but it will require us to find a solution to an issue.

We’ll start by installing the already familiar go-demo-5 application.

GD5_ADDR=go-demo-5.$LB_IP.nip.io

kubectl create namespace go-demo-5

helm install go-demo-5 \
    https://github.com/vfarcic/go-demo-5/releases/download/0.0.1/go-demo-5-0.0.1.tgz \
    --namespace go-demo-5 \
    --set ingress.host=$GD5_ADDR

kubectl -n go-demo-5 \
    rollout status \
    deployment go-demo-5

We declared GD5_ADDR with the address through which we’ll be able to access the application. We used it as an ingress.host variable when we installed the go-demo-5 Chart. To be on the safe side, we waited until the app rolled out, and all that’s left, from the deployment perspective, is to confirm that it is running by sending an HTTP request.

curl http://$GD5_ADDR/demo/hello

The output is the developer’s favorite message hello, world!.

Simulate an issue #

Next, we’ll simulate an issue by sending twenty slow requests with up to ten seconds duration. That will be our simulation of a problem that might need to be fixed.

for i in {1..20}; do
    DELAY=$[ $RANDOM % 10000 ]
    curl "http://$GD5_ADDR/demo/hello?delay=$DELAY"
done

Application is too slow #

Since we already have Prometheus's alerts, we should receive a notification on Slack stating that the application is too slow. However, many readers might be using the same channel for those exercises, and it might not be clear whether the message comes from us. Instead, we’ll open the Prometheus' alerts screen to confirm that there is a problem. In the “real” setting, you wouldn’t be checking Prometheus alerts, but wait for notifications on Slack, or whichever notifications tool you chose.

open "http://$PROM_ADDR/alerts"

A few moments later (don’t forget to refresh the screen), the AppTooSlow alert should fire, letting us know that one of our applications is slow and that we should do something to remedy the problem.

📌 True to the promise that each chapter will feature outputs and screenshots from a different Kubernetes flavor, this time it’s minikube’s turn.

Get hands-on with 1000+ tech skills courses.