“kubectl wait” waits forever Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!kibana in the kebernets cluster doesn't workWait for canal pod before scheduling pods on new nodeWhy does kubernetes produce multiple errors when CPU usage is high?Finding the name of a new pod with kubectlList of Kubernetes status conditions for jobs?spark driver pod stuck in Waiting: PodInitializing state in KubernetesCan you auto destroy a kubernetes pod deployment?How to check when “kubectl delete” failed with “timeout waiting for … to be synced”Kubernetes Job Status checkDoesn't Kubernetes honor HPA configuration when we execute “kubectl scale deploy”?

Book with legacy programming code on a space ship that the main character hacks to escape

Will I lose my paid in full property

How to not starve gigantic beasts

Multiple fireplaces in an apartment building?

Could moose/elk survive in the Amazon forest?

Suing a Police Officer Instead of the Police Department

c++ diamond problem - How to call base method only once

Function to calculate red-edgeNDVI in Google Earth Engine

Are all CP/M-80 implementations binary compatible?

Error: Syntax error. Missing ')' for CASE Statement

Where did Arya get these scars?

Visa-free travel to the US using refugee travel document from Spain?

What's the difference between using dependency injection with a container and using a service locator?

My admission is revoked after accepting the admission offer

A Paper Record is What I Hamper

How long after the last departure shall the airport stay open for an emergency return?

Mistake in years of experience in resume?

Trumpet valves, lengths, and pitch

Is accepting an invalid credit card number a security issue?

What is the least dense liquid under normal conditions?

How can I wire a 9-position switch so that each position turns on one more LED than the one before?

Why didn't the Space Shuttle bounce back into space as many times as possible so as to lose a lot of kinetic energy up there?

Do I need to protect SFP ports and optics from dust/contaminants? If so, how?

What is the ongoing value of the Kanban board to the developers as opposed to management



“kubectl wait” waits forever



Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manara
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!kibana in the kebernets cluster doesn't workWait for canal pod before scheduling pods on new nodeWhy does kubernetes produce multiple errors when CPU usage is high?Finding the name of a new pod with kubectlList of Kubernetes status conditions for jobs?spark driver pod stuck in Waiting: PodInitializing state in KubernetesCan you auto destroy a kubernetes pod deployment?How to check when “kubectl delete” failed with “timeout waiting for … to be synced”Kubernetes Job Status checkDoesn't Kubernetes honor HPA configuration when we execute “kubectl scale deploy”?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I'm trying to write a little shell script that is checking the log output of a long running Kubernetes Pod when the Pod is done.



The script shall wait for status "Completed" but the following command does not exit when the status is switching from "Running" to "Completed":




$ kubectl wait --for=condition=Completed --timeout=24h pod/longrunningpodname



^C



$ kubectl get pods



NAME READY STATUS RESTARTS AGE



longrunningpodname 0/1 Completed 0 18h




I would also expect the command to return immediately if the Pod is already in the status. But that doesn't happen.



Is kubectl wait not the command I'm looking for?










share|improve this question




























    1















    I'm trying to write a little shell script that is checking the log output of a long running Kubernetes Pod when the Pod is done.



    The script shall wait for status "Completed" but the following command does not exit when the status is switching from "Running" to "Completed":




    $ kubectl wait --for=condition=Completed --timeout=24h pod/longrunningpodname



    ^C



    $ kubectl get pods



    NAME READY STATUS RESTARTS AGE



    longrunningpodname 0/1 Completed 0 18h




    I would also expect the command to return immediately if the Pod is already in the status. But that doesn't happen.



    Is kubectl wait not the command I'm looking for?










    share|improve this question
























      1












      1








      1








      I'm trying to write a little shell script that is checking the log output of a long running Kubernetes Pod when the Pod is done.



      The script shall wait for status "Completed" but the following command does not exit when the status is switching from "Running" to "Completed":




      $ kubectl wait --for=condition=Completed --timeout=24h pod/longrunningpodname



      ^C



      $ kubectl get pods



      NAME READY STATUS RESTARTS AGE



      longrunningpodname 0/1 Completed 0 18h




      I would also expect the command to return immediately if the Pod is already in the status. But that doesn't happen.



      Is kubectl wait not the command I'm looking for?










      share|improve this question














      I'm trying to write a little shell script that is checking the log output of a long running Kubernetes Pod when the Pod is done.



      The script shall wait for status "Completed" but the following command does not exit when the status is switching from "Running" to "Completed":




      $ kubectl wait --for=condition=Completed --timeout=24h pod/longrunningpodname



      ^C



      $ kubectl get pods



      NAME READY STATUS RESTARTS AGE



      longrunningpodname 0/1 Completed 0 18h




      I would also expect the command to return immediately if the Pod is already in the status. But that doesn't happen.



      Is kubectl wait not the command I'm looking for?







      kubernetes kubectl






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 22 at 15:54









      SimonSimon

      82




      82






















          1 Answer
          1






          active

          oldest

          votes


















          1














          The use of bare pods is not the best approach to run commands that must finish. Consider using a Job Controller:




          A Job creates one or more Pods and ensures that a specified number of
          them successfully terminate. As pods successfully complete, the Job
          tracks the successful completions.




          Then, you can wait for the job condition:
          kubectl wait --for=condition=complete --timeout=24h job/longrunningjobname






          share|improve this answer




















          • 1





            Okay, this works: I've changed the yaml config from pod to job and have to use --for=condition=complete instead of --for=condition=completed. That did the trick. Thank you!

            – Simon
            Mar 23 at 10:30











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55303430%2fkubectl-wait-waits-forever%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          The use of bare pods is not the best approach to run commands that must finish. Consider using a Job Controller:




          A Job creates one or more Pods and ensures that a specified number of
          them successfully terminate. As pods successfully complete, the Job
          tracks the successful completions.




          Then, you can wait for the job condition:
          kubectl wait --for=condition=complete --timeout=24h job/longrunningjobname






          share|improve this answer




















          • 1





            Okay, this works: I've changed the yaml config from pod to job and have to use --for=condition=complete instead of --for=condition=completed. That did the trick. Thank you!

            – Simon
            Mar 23 at 10:30















          1














          The use of bare pods is not the best approach to run commands that must finish. Consider using a Job Controller:




          A Job creates one or more Pods and ensures that a specified number of
          them successfully terminate. As pods successfully complete, the Job
          tracks the successful completions.




          Then, you can wait for the job condition:
          kubectl wait --for=condition=complete --timeout=24h job/longrunningjobname






          share|improve this answer




















          • 1





            Okay, this works: I've changed the yaml config from pod to job and have to use --for=condition=complete instead of --for=condition=completed. That did the trick. Thank you!

            – Simon
            Mar 23 at 10:30













          1












          1








          1







          The use of bare pods is not the best approach to run commands that must finish. Consider using a Job Controller:




          A Job creates one or more Pods and ensures that a specified number of
          them successfully terminate. As pods successfully complete, the Job
          tracks the successful completions.




          Then, you can wait for the job condition:
          kubectl wait --for=condition=complete --timeout=24h job/longrunningjobname






          share|improve this answer















          The use of bare pods is not the best approach to run commands that must finish. Consider using a Job Controller:




          A Job creates one or more Pods and ensures that a specified number of
          them successfully terminate. As pods successfully complete, the Job
          tracks the successful completions.




          Then, you can wait for the job condition:
          kubectl wait --for=condition=complete --timeout=24h job/longrunningjobname







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 22 at 17:00

























          answered Mar 22 at 16:55









          Eduardo BaitelloEduardo Baitello

          1,059522




          1,059522







          • 1





            Okay, this works: I've changed the yaml config from pod to job and have to use --for=condition=complete instead of --for=condition=completed. That did the trick. Thank you!

            – Simon
            Mar 23 at 10:30












          • 1





            Okay, this works: I've changed the yaml config from pod to job and have to use --for=condition=complete instead of --for=condition=completed. That did the trick. Thank you!

            – Simon
            Mar 23 at 10:30







          1




          1





          Okay, this works: I've changed the yaml config from pod to job and have to use --for=condition=complete instead of --for=condition=completed. That did the trick. Thank you!

          – Simon
          Mar 23 at 10:30





          Okay, this works: I've changed the yaml config from pod to job and have to use --for=condition=complete instead of --for=condition=completed. That did the trick. Thank you!

          – Simon
          Mar 23 at 10:30



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55303430%2fkubectl-wait-waits-forever%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript