I've looked over the documentation and browsed the source, but I can't seem to figure out how to do this. Is there any way to send query string parameters along with the path when implementing a Kubernetes liveness probe?
The string I am sending, which looks something like this:
/api/v1?q=...
becomes URL-encoded and hits the server as:
/api/v1%3fq=...
As I have no such route on this particular API, I get a 404, and Kube reaps the pods after the allotted timeout.
Is there any way to define query string parameters to liveness probes and/or trick the URI encoder to allow query string parameters?
The readiness probe is configured in the spec. containers. readinessprobe attribute of the pod configuration. Liveness probes determine whether or not an application running in a container is in a healthy state.
3.1) Use the kubectl edit command to edit the deployment definition and add readiness and liveness probes. For the liveness probe, use the /healthz endpoint on the port 8080 . For the readiness probe, use the /ready endpoint on the port 8080 .
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.
Kubernetes will send gRPC health check requests to port 2379 in the container. 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.
EDIT: This should now be fixed in Kubernetes 1.3. Thanks to Rudi C for pointing that out.
Liveness probes in Kubernetes v1.2 don't support passing query parameters.
This Issue in the Deis Controller repo has a good explanation. The gist is that the LivenessProbe.HttpGet.Path is treated as a true URL path (which needs the "?" to be escaped as "%3f").
I've opened a feature request Issue against Kubernetes to discuss adding query parameter(s).
As a workaround, you could use an exec livenessProbe that included the query parameters (as long as your container includes something like wget or curl):
livenessProbe:
exec:
command:
- wget
- /api/v1?q=...
Which version are you running? The escaping is a bug that was supposed to be fixed in 1.3:
https://github.com/kubernetes/kubernetes/pull/25064
Not perfect, but it doesn't require additional API fields in the YAML.
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