Specify a httpGet and exec handler in a liveness/readiness probe

3/13/2018

Is it possible to have multiple handlers in a container probe ? Something like

livenessProbe: {
     httpGet: {
         path: "/ping",
         port: 9099
     },
     exec: {
         command: [
             "verify-correctness.sh",
         ]
     }
 }

Update:

At Kube 1.6x kubectl apply for a config like this returns

spec.template.spec.containers[0].livenessProbe.httpGet: Forbidden: may not specify more than 1 handler type

So maybe not supported ?


Update 2:

After Ara Pulido's answer I combined the httpGet into the command like this:

 "livenessProbe": {
             "exec": {
                "command": [
                   "sh",
                   "-c",
                   "reply=$(curl -s -o /dev/null -w %{http_code} http://127.0.0.1:9099/ping); if [ \"$reply\" -lt 200 -o \"$reply\" -ge 400 ]; then exit 1; fi; verify-correctness.sh;"
                ]
             }
          }
-- Hakan Baba
kubernetes

1 Answer

3/13/2018

It is not supported.

There is an open issue about this, which contains several workarounds people use.

-- Ara Pulido
Source: StackOverflow