eficode-academy / kubernetes-katas

Deliberate exercises for Kubernetes
265 stars 275 forks source link

health-check exercise could use an update. #50

Closed figaw closed 3 years ago

figaw commented 4 years ago

Previously the latter half went like this:

(Optional) Creating your own App with a Health Check

Any (http) code greater than or equal to 200 and less than 400 indicates success. Any other code indicates failure.

Let's go back to our applications, and create a custom health check.

Create an endpoint that does something customized, and returns 200. (Make sure it can fail and return an error above 500 if you want to test).

Push the container, and create a deployment for it and include:

  livenessProbe:
      httpGet:
        path: /healthz #Your endpoint for health check.
        port: 8080
        httpHeaders:
        - name: X-Custom-Header
          value: Awesome
      initialDelaySeconds: 3
      periodSeconds: 3

Verify that the healthcheck fails when conditions are not met.

This concludes the exercise for health checks!

Supposedly it was part of a bigger set of exercises? It would probably be nice to provide them with a demo application, that they could make fail in some way.

I'm removing for now because it leaves the exercise in a weird state, and the first half actually seems to be a nice little taster.