kubernetes: Probe timeout ignored by ExecAction

I’m using a readiness probe that may take a long time to run, and I expected it to be interrupted after the specified timeout.

A probe defined like this:

"readinessProbe": {
  "exec": {
    "command": ["bash", "-c", "sleep 15"]
  },
  "timeoutSeconds": 5
}

Instead of timing out and failing, it is actually succeeding and ignoring the timeout.

I noticed that both TCPSocketAction and HTTPGetAction probes timeout according to the value of TimeoutSeconds, ExecAction on the other hand ignores it.

Looking at the code:

if p.Exec != nil, no reference to timeout: pkg/kubelet/prober/prober.go#L146

if p.HTTPGet != nil || p.TCPSocket != nil, timeout is used: pkg/kubelet/prober/prober.go#L163 pkg/kubelet/prober/prober.go#L171

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 6
  • Comments: 32 (16 by maintainers)

Commits related to this issue

Most upvoted comments

/remove-lifecycle rotten

I’m still seeing this.

@tedyu thanks for fixing! I also ran into this 😦

For anyone looking for a workaround, I used the timeout command and it seems to have the intended effect.

That is, something like…

"readinessProbe": {
  "exec": {
    "command": ["bash", "-c", "timeout 5 sleep 15"]
  },
}