Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What if Job fails?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

In this issue, the editor will bring you about what to do if Job fails. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

What happens if Job fails?

Modify myjob.yml to deliberately introduce an error:

Delete the previous Job first:

What happens if restartPolicy is set to OnFailure? Let's put it into practice, modify myjob.yml and restart it.

Run the new Job and view the status:

The number of Pod in the current SUCCESSFUL is 0. Check the status of Pod.

You can see that there are multiple Pod, all of which are abnormal. Kubectl describe pod looks at the startup log of a Pod:

The log shows that there are no executable programs, in line with our expectations.

Here's an explanation: why does kubectl get pod see so many failed Pod?

The reason is: when the first Pod starts, the container fails to exit. According to restartPolicy: Never, the failed container will not be restarted, but the Pod of Job DESIRED is 1, and the current SUCCESSFUL is 0, which is not satisfied, so Job controller will start a new Pod until the SUCCESSFUL is 1. For our example, SUCCESSFUL will never reach 1, so Job controller will always create new Pod. To terminate this behavior, you can only delete Job.

The number of SUCCESSFUL Pod in Job is still 0. Take a look at Pod.

There is only one Pod, but the RESTARTS is 3, and it keeps increasing, which means that the OnFailure takes effect, and the container will restart automatically if it fails.

The above is the editor for you to share the Job failed how to do, if there happen to be similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report