You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The documentation of kubectl wait is a bit miss-leading #754
I personally understand this as the timeout for the entire command but after experimenting with it a bit I realised that the value of this option is per resource. For example, if I am waiting for a set of 10 pods to be Ready and used --timeout=60s, I might end up waiting for 10 minutes before the command exits, and not just 1 minute as I assumed.
So as I see it, there are 2 possible solutions here:
Improve the documentation.
Change the implementation so that the --timeout value will be for the entire command duration (preferable solution in my opinion).
Reacted by Carlos Sanchez, Nathan Bird, Michal Kaptur, cowaar, Scott Schulthess, Ilayaraja Murugesan and Miguel Almeida
I implemented sort of a wrapper for internal use with the following logic:
run kubectl wait <resources> --timeout=0
parse the output from step 1 to get a list of unready_pods
while (command_elapsed_time < command_timeout and len(unready_pods) > 0)
a. run kubectl wait <unready_pods> --timeout=0
b. parse the output from step 3.a to get a list of unready_pods
if len(unready_pods) > 0
a. raise a command_timeout exception.
IMHO, this logic fits better to the use cases kubernetes users encounter on the day to day work but again, my opinion only. I'm not a go developer so I can't submit a PR with this logic but I would definitely like to hear more opinions about this logic.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
I just experienced exactly the issue described in the OP, and found it very confusing. I noticed these log messages from my e2e test:
+ kubectl wait --for=condition=ready pod -l prepull-test-images=e2e --timeout 30m
timed out waiting for the condition on pods/prepull-test-containers-gxjhh
timed out waiting for the condition on pods/prepull-test-containers-mqf4j
timed out waiting for the condition on pods/prepull-test-containers-r96tp
+ kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
prepull-test-containers-gxjhh 14/17 CrashLoopBackOff 85 92m 10.64.2.3 e2e-726b009feb-d872a-windows-node-group-ltb5 <none> <none>
prepull-test-containers-mqf4j 14/17 CrashLoopBackOff 84 92m 10.64.1.3 e2e-726b009feb-d872a-windows-node-group-0qdq <none> <none>
prepull-test-containers-r96tp 14/17 CrashLoopBackOff 82 92m 10.64.3.3 e2e-726b009feb-d872a-windows-node-group-lc19 <none> <none>
The age of the pods is 90 minutes rather than the 30 minutes I expected, because kubectl wait is applying the timeout to each selected pod sequentially. This is very unintuitive to me. If this default behavior can't be changed, perhaps a flag can be added to change the behavior to enforce the timeout across all selected pods/conditions.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
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.
This seemed to be a confirmed bug, and is definitely still present, quite confusing, and makes it basically impossible to use kubectl wait for more than one resource in any useful fashion
This seemed to be a confirmed bug, and is definitely still present, quite confusing, and makes it basically impossible to use kubectl wait for more than one resource in any useful fashion
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.
Activity
zhouya0 commentedon Nov 7, 2019
Actually the
kubectl waitwill do thewatchrequest for every single resource and do the request one by one:But watch request is actually a unlimited connection so every request has a timeout(default is 30s in wait).
So the only way to do your second solution is average time for the timeout, but seems not very good to do that.
eranreshef commentedon Nov 7, 2019
I implemented sort of a wrapper for internal use with the following logic:
kubectl wait <resources> --timeout=0a. run
kubectl wait <unready_pods> --timeout=0b. parse the output from step 3.a to get a list of unready_pods
a. raise a command_timeout exception.
IMHO, this logic fits better to the use cases kubernetes users encounter on the day to day work but again, my opinion only. I'm not a go developer so I can't submit a PR with this logic but I would definitely like to hear more opinions about this logic.
fejta-bot commentedon Feb 5, 2020
Issues go stale after 90d of inactivity.
Mark the issue as fresh with
/remove-lifecycle stale.Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with
/close.Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale
fejta-bot commentedon Mar 6, 2020
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with
/remove-lifecycle rotten.Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with
/close.Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
pjh commentedon Mar 31, 2020
/remove-lifecycle rotten
I just experienced exactly the issue described in the OP, and found it very confusing. I noticed these log messages from my e2e test:
The age of the pods is 90 minutes rather than the 30 minutes I expected, because
kubectl waitis applying the timeout to each selected pod sequentially. This is very unintuitive to me. If this default behavior can't be changed, perhaps a flag can be added to change the behavior to enforce the timeout across all selected pods/conditions.Wrap kubectl wait with coreutils timeout
brianpursley commentedon Apr 29, 2020
/kind bug
seans3 commentedon Jul 22, 2020
/area kubectl
/sig cli
5 remaining items
fejta-bot commentedon Dec 27, 2020
Issues go stale after 90d of inactivity.
Mark the issue as fresh with
/remove-lifecycle stale.Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with
/close.Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale
eranreshef commentedon Dec 27, 2020
/remove-lifecycle stale
fejta-bot commentedon Mar 27, 2021
Issues go stale after 90d of inactivity.
Mark the issue as fresh with
/remove-lifecycle stale.Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with
/close.Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
fejta-bot commentedon Apr 26, 2021
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with
/remove-lifecycle rotten.Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with
/close.Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
fejta-bot commentedon May 26, 2021
Rotten issues close after 30d of inactivity.
Reopen the issue with
/reopen.Mark the issue as fresh with
/remove-lifecycle rotten.Send feedback to sig-contributor-experience at kubernetes/community.
/close
k8s-ci-robot commentedon May 26, 2021
@fejta-bot: Closing this issue.
Details
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.
mgabeler-lee-6rs commentedon May 25, 2022
/reopen
This seemed to be a confirmed bug, and is definitely still present, quite confusing, and makes it basically impossible to use
kubectl waitfor more than one resource in any useful fashionk8s-ci-robot commentedon May 25, 2022
@mgabeler-lee-6rs: You can't reopen an issue/PR unless you authored it or you are a collaborator.
Details
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.
mgabeler-lee-6rs commentedon May 25, 2022
ok, fine, #1219