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
kubelet: Make probe to be on for time drift #123898
base: master
Are you sure you want to change the base?
Conversation
Hi @pperiyasamy. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pperiyasamy The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/release-note-none |
/retest-required |
/remove-sig api-machinery |
@jiahuif: Those labels are not set on the issue: In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Does this PR need a changelog entry? |
// earlier than system current time. But probe must be on for time drift case, | ||
// This may happen due to nvram flash which resets system BIOS settings and RTC. | ||
startedAtInSecs := time.Since(c.State.Running.StartedAt.Time).Seconds() | ||
if startedAtInSecs > 0 && int32(startedAtInSecs) < w.spec.InitialDelaySeconds { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to wait InitialDelaySeconds
since doProbe
called first time if startedAtInSecs <= 0
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bart0sh good point, but would that happen (i.e. pod startup followed by immediate time drift event before InitialDelaySeconds
) ? In our case, time drift just happened during node maintenance on a existing pod.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My point was that if startedAtInSecs <= 0
probe would run immediately, which is not desirable. It's better to wait for InitialDelaySeconds just to be on the safe side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok @bart0sh , added code to wait for InitialDelaySeconds
when time drift happens.
/triage accepted |
out of curiosity: is the the only bug you found in this scenerio? I feel like there would be a lot of little issues with this situation (and I'm not even sure if this is something that the kubelet should support...) |
The initialDelaySeconds holds readiness probe for specified seconds after container has started. To achieve this, kubelet relies on StartedAt time of container which never change during its lifetime. But in case of time drift scenario (example: During node maintenance, NVRAM is flashed, looks like it resets BIOS settings and RTC is affected), The StartedAt time may contain future time which makes probe to be disabled until system reaches StartedAt time. Hence this commit handles this scenario and makes probe to be still initiated for those cases. Signed-off-by: Periyasamy Palanisamy <pepalani@redhat.com>
e862d3c
to
1604d6a
Compare
@haircommander The readiness probe failure happened on networking pod, so it prevented K8s cluster itself not to come up properly. But after recreation of networking pod, cluster came up just fine. @brunogomes011 might have more details about this. |
@pperiyasamy: GitHub didn't allow me to request PR reviews from the following users: jcaamano, kyrtapz. Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@pperiyasamy: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
// once container's elapsed start time reaches +ve value. | ||
timeDrift bool | ||
// timeDriftStartTimeInSec contains container's elapsed start time at | ||
// the time of first occurance of time drift. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// the time of first occurance of time drift. | |
// the time of first occurrence of time drift. |
@pperiyasamy I agree with @haircommander here. Keeping machine system clock synchronized is a basic administration task. I'm not sure Kubelet should work around incorrectly set system clock. |
What we may want to do is to check this and report(log & send an event), so user would at least be able to see the reason of probe(or anything else) not working as expected. |
One way to check: make a request to the API server, look at the |
The
initialDelaySeconds
holds readiness probes for specified seconds after container has started. To achieve this, kubelet relies onStartedAt
time of container which never change during its lifecycle. But in case of time drift scenario (example: During maintenance, NVRAM is flashed, looks like it resets the BIOS settings and RTC is also affected), TheStartedAt
time may contain future time which makes probe to be disabled until system reachesStartedAt
time. Hence this commit handles this scenario and makes probe to be still initiated for those cases.What type of PR is this?
/kind bug
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: