In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to use k8s to run a one-time task, I believe many inexperienced people are helpless about this, for this reason this article summarizes the causes and solutions of the problem, through this article I hope you can solve this problem.
Containers can be divided into two categories according to their running time: service containers and work containers.
Service containers usually provide services continuously and need to be running all the time, such as http server, daemon, etc. Work-class containers are one-time tasks, such as batch programs, that exit after completion.
Kubernetes Deployment, ReplicaSet, and DaemonSet are all used to manage service class containers; for work class containers, we use Job.
Let's start with a simple Job profile myjob.yml:
batch/v1 is the apiVersion of the current Job.
2 indicates that the current resource type is Job.
restartPolicy specifies when the container needs to be restarted. For Job, it can only be set to Never or OnFailure. For other controllers (e.g. Deployment) it can be set to Always.
Start Job with kubectl apply -f myjob.yml.
DESIRED and SUCCESSFUL are both 1, indicating that a Pod started as expected and executed successfully. kubectl get pod Check the status of the Pod:
These are the cases where the Pod succeeds, but what happens if the Pod fails?
After reading the above, do you know how to run one-time quests with k8s? If you still want to learn more skills or want to know more related content, welcome to pay attention to the industry information channel, thank you for reading!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.