I'm running a web service that I can not change any of the specifications. I want to use liveness probe with HTTP POST on Kubernetes. I couldn't find anything available. All of my efforts with busybox and netcat have failed.
Is there a solution? Is it possible to build a custom liveness probe from any Linux dist?
Readiness probes are configured similarly to liveness probes. The only difference is that you use the readinessProbe field instead of the livenessProbe field. Configuration for HTTP and TCP readiness probes also remains identical to liveness probes.
The liveness probe will be marked as failed when the container issues an unhealthy response. The probe is also considered failed if the service doesn't implement the gRPC health checking protocol. Monitor the health of your cluster and troubleshoot issues faster with pre-built dashboards that just work.
What if I don't specify a liveness probe? If you don't specify a liveness probe, then OpenShift will decide whether to restart your container based on the status of the container's PID 1 process. The PID 1 process is the parent process of all other processes that run inside the container.
The kubelet can optionally perform and react to three kinds of probes on running containers: livenessProbe. Indicates whether the container is running. If the liveness probe fails, the kubelet kills the container, and the container is subjected to its restart policy.
Kubernetes Probes only support HTTP GET, TCP & Command.
If you must check something over HTTP POST you could use a command approach and just curl -XPOST ..
An example would be:
...
containers:
- name: k8-byexamples-spring-rest
image: gcr.io/matthewdavis-byexamples/k8-byexamples-spring-rest:1d4c1401c9485ef61322d9f2bb33157951eb351f
ports:
- containerPort: 8080
name: http
livenessProbe:
exec:
command:
- curl
- -X POST
- http://localhost/test123
initialDelaySeconds: 5
periodSeconds: 5
...
For more explanation see: https://matthewdavis.io/kubernetes-health-checks-demystified/.
Hope that helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With