Increase startup threshold for k8s container in v1.12

10/16/2019

Following the documentation here, I could set the threshold for container startup like so:

startupProbe:
  httpGet:
    path: /healthz
    port: liveness-port
  failureThreshold: 30
  periodSeconds: 10

Unfortunately, it seems like startupProbe.failureThreshold is not compatible with our current k8s version (1.12.1):

unknown field "startupProbe" in io.k8s.api.core.v1.Container; if you choose to ignore these errors, turn validation off with --validate=false

Is there a workaround for this? I'd like to give a container a chance of ~40+ minutes to start.

-- Kludge
kubernetes
kubernetes-container
kubernetes-pod

2 Answers

11/20/2019

If you have a probe, you could specify initialDelaySeconds and make it some large value that is sufficient for your container to start up.

If you didn't care about probes at all, then you could just let it execute a command that will never fail e.g. whoami

Take what you need from the example below:

readinessProbe:
  exec:
    command:
    - whoami
  initialDelaySeconds: 2400
  periodSeconds: 5

You could do the same config for livenessProbe if you require one.

-- Asu
Source: StackOverflow

10/16/2019

Yes, startupProbe was introduced with 1.16 - so you cannot use it with Kubernetes 1.12.

I am guessing you are defining a livenessProbe - so the easiest way to get around your problem is to remove the livenessProbe. Most applications won't need one (some won't even need a readinessProbe). See also this excellent article: Liveness Probes are Dangerous.

-- koe
Source: StackOverflow