flix
flix

Reputation: 2033

Kubernetes: How to simulate a liveness probe on distroless containers?

I have a pod which keeps restarting because of failed liveliness probes:

Events:
   ... Container ... failed liveness probe, will be restarted

I suspect the the liveliness timeout of 1 sec is the issue here.

The liveliness probe is defined as follows:

livenessProbe:
  httpGet:
    path: /health
    port: 80
    scheme: HTTP

Is there a way to simulate the HTTP request with kubectl to take a few samples on the response time?

execing into the container and running curl is not an option, because the container is distroless.

Felix

Upvotes: 1

Views: 603

Answers (1)

Tom Klino
Tom Klino

Reputation: 2504

You can port-forward to the container with kubectl and then try to query the health api endpoint.

Also, slow down your livenessProbe while you check that with initialDelaySeconds: 120 (in the livenessProbe object, outside the httpGet)

Like so:

livenessProbe:
  initialDelaySeconds: 120
  httpGet:
    path: /health
    port: 80
    scheme: HTTP

Upvotes: 2

Related Questions