Increase startup threshold for k8s container in v1.12

2.5k views Asked by At

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.

3

There are 3 answers

5
derkoe On BEST ANSWER

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.

0
ElSinus On

I know this is not an answer for this question, but can be useful...

"startupProbes" comes with k8s 1.16+.

If you are suing helm you can surround your block startupProbes with this in your template:

{{- if (semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion) }}
startupProbe:
  httpGet:
    path: /healthz
    port: liveness-port
  failureThreshold: 30
  periodSeconds: 10
{{- end }}
0
Asu On

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.