Kubernetes liveness probes with query string parameters

a 夏天 提交于 2019-12-01 06:33:19

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 have some kind of token authorization (via get parameter) and you have health check on root (service-name/), you should omit the slash, for example:

readinessProbe:
  httpGet:
    path: ?token=${TOKEN}
    port: 80
    scheme: HTTP

I had to look through PR changes to find the way to specify it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!