1
votes

From the K8S document about Configure liveness, readiness probes, suppose the values of successThreshold and failureThreshold are little big, and probes fail to meet the bar of successThreshold and failureThreshold at the same time when pods run at the very beginning, what status of pods should be then?

1

1 Answers

0
votes

I guess you don't fully understand readiness and liveness probe.

Readiness Probe

Readiness probes are designed to let Kubernetes know when your app is ready to serve traffic. Kubernetes makes sure the readiness probe passes before allowing a service to send traffic to the pod. If a readiness probe starts to fail, Kubernetes stops sending traffic to the pod until it passes.

Also as per official Kubernetes docs.

If the readiness probe fails, the endpoints controller removes the Pod’s IP address from the endpoints of all Services that match the Pod. The default state of readiness before the initial delay is Failure. If a Container does not provide a readiness probe, the default state is Success.

For example, if your application needs about 15 seconds since it will work correctly, needs to load huge amount of data you can set readinessProbe. It's helpful when you are scaling your deployment or need a while before Pod will receive data.

For a readiness probe, the failureThreshold value defines how many times the probe must fail before the pod is removed from the endpoint list.

Liveness Probe

Liveness probes let Kubernetes know if your app is alive or dead. If you app is alive, then Kubernetes leaves it alone. If your app is dead, Kubernetes removes the Pod and starts a new one to replace it.

In short, when your application is running, Kubernetes is checking in time periods wheter it can access some shares, if yes, it returns success. If not, it counting it as fail and tries again, till probe will reach failureThreshold. After reaching this value, pod will be restarted.

===

Based on the docs example.

readinessProbe when it will be successful:

readiness-exec   0/1   Pending   0     0s
readiness-exec   0/1   Pending   0     0s
readiness-exec   0/1   ContainerCreating   0     0s
readiness-exec   0/1   Running   0     8s
readiness-exec   1/1   Running   0     15s
readiness-exec   0/1   Completed   0     98s

readinessProbe when it will fail:

readiness-exec   0/1   Pending   0     0s
readiness-exec   0/1   Pending   0     0s
readiness-exec   0/1   ContainerCreating   0     0s
readiness-exec   0/1   Running   0     3s
readiness-exec   0/1   Completed   0     92s

It will not create pod as readinessProbe failed. In description of the pod:

Warning  Unhealthy  2s (x12 over 57s)  kubelet, gke-default-pool-bc1968b0-1sh7  Readiness probe failed: cat: /tmp/healthyyyyy: No such file or directory

Regarding livenessProbe when it reach failureThreshold container will do what was set in RestartPolicy.

As information generated by probes are stored in kubelet you can describe pod to check current status. If you want to get more detailed information, you have to use $ journalctl -u kubelet like in this case.

You can find many articles online about this. For example google article or openshift article.

Check this docs with information, when use probes.

If this didn't answer, please edit your question.