Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readiness probe keeps running when the pod is ready #37450

Closed
Nicofuma opened this issue Nov 24, 2016 · 5 comments
Closed

Readiness probe keeps running when the pod is ready #37450

Nicofuma opened this issue Nov 24, 2016 · 5 comments

Comments

@Nicofuma
Copy link

Kubernetes version (use kubectl version): v1.2.0-36

Environment:

  • Cloud provider or hardware configuration: OpenShift Enterprise v3

What happened:
I am using an OpenShift 3.2.0.44 platform (which is running Kubernetes master 1.2.0-36-g4a3f9c5).
On this platform I launched a POD with a single container, which has a readiness probe. My issue is that when the container is determined as being ready, I can see the process of the probe spawning regularly (according to the periodSeconds value)

Note: it seems that there is another issue with periodSeconds: I tried to set the following readiness probe and have a warning saying that my container didn't pass its readiness check. Considering the executed command, it looks like the first check will be spawned at least 3600 seconds after the creation of the container

              readinessProbe:
                exec:
                  command:
                    - "true"
                initialDelaySeconds: 30
                timeoutSeconds: 1
                periodSeconds: 3600
                successThreshold: 1
                failureThreshold: 1

What you expected to happen:
Once the pod is determined ready I am not expecting the readiness probe to keep being spawned (which eats up resources).

How to reproduce it (as minimally and precisely as possible):
Adds this readiness probe and looks at the /tmp/readiness file in the pod:

              readinessProbe:
                exec:
                  command:
                    - "bash"
                    - "-c"
                    - "echo test >> /tmp/readiness"
                initialDelaySeconds: 30
                timeoutSeconds: 1
                periodSeconds: 1
                successThreshold: 1
                failureThreshold: 1

You will see an entry appended to the file every second.

Anything else do we need to know:
I apologize if it has already been reported or fixed but I didn't see anything related in the changelog or in the issues.

@Nicofuma Nicofuma changed the title Readiness probes keeps running when the pod is ready Readiness probe keeps running when the pod is ready Nov 24, 2016
@Nicofuma
Copy link
Author

If I am reading the source code (https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/prober/worker.go) correctly, both issues are still present in master.

There isn't any special case to stop readiness probe when the success threshold is hit, and the tickers' first tick is not immediate but respect the configured delay (the periodSeconds in our case)

@Nicofuma
Copy link
Author

I re-read the doc and it's actually the expected behaviour so closing it.

@ticpu
Copy link

ticpu commented Oct 23, 2018

I could not find where in the doc this is expected; https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#define-readiness-probes

I was also expecting the behaviour you mentioned in your original issue.

That is what I understood from the name (and documentation) of the probes.
Readyness probe starts after initialDelaySeconds, tries again each periodSeconds for successThreshold# times and will retry if probe takes more than timeoutSeconds between periodSeconds.
Once pod is marked as ready, stop readynessProbe and engage livenessProbe until the container stops responding or is stopped.

Am I also mistaken?

@ylfforme
Copy link

ylfforme commented Nov 13, 2018

I could not find where in the doc this is expected; https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#define-readiness-probes

I was also expecting the behaviour you mentioned in your original issue.

That is what I understood from the name (and documentation) of the probes.
Readyness probe starts after initialDelaySeconds, tries again each periodSeconds for successThreshold# times and will retry if probe takes more than timeoutSeconds between periodSeconds.
Once pod is marked as ready, stop readynessProbe and engage livenessProbe until the container stops responding or is stopped.

Am I also mistaken?

readinessProbe and livenessProbe all need to keep running . livenessProbe check the container is live or dead if dead restart the container. But it can't tell the service if the pod is ok to serve traffic. The readinessProbe is tell the service if the pod is ok to serve traffic. if it not ok,the pod ip will delete from service endpoints, so It needs to keep running too.

@ticpu
Copy link

ticpu commented Nov 13, 2018

Thanks for clarifying. After some tests I was able to confirm that behaviour.

The part of the documentation that mislead me was;

For example, an application might need to load large data or configuration files during startup.

since it ends by "during startup". But this is only one common example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants