In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to execute Job regularly, I believe many inexperienced people don't know what to do about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
There are cron programs in Linux that execute tasks regularly, and CronJob of Kubernetes provides a similar function to execute Job on a regular basis. An example of a CronJob configuration file is as follows:
① batch/v2alpha1 is the apiVersion of the current CronJob.
② indicates that the type of the current resource is CronJob.
③ schedule specifies when to run Job in the same format as Linux cron. Here * / 1 * means to start every minute.
④ jobTemplate defines the template for Job in the same format as the previous Job.
Next, create the CronJob through kubectl apply.
Kube-apiserver itself is a Pod, just add-- runtime-config=batch/v2alpha1=true to the startup parameters.
Then restart the kubelet service:
Systemctl restart kubelet.service
Kubelet restarts kube-apiserver Pod. Confirm through kubectl api-versions that kube-apiserver now supports batch/v2alpha1:
It worked this time. View the status of CronJob through kubectl get cronjob:
You can see that a Job starts every other minute. Execute kubectl logs to view the running log of a Job
Running containerized applications is the most important core function of Kubernetes. In order to meet different business needs, Kubernetes provides a variety of Controller, including Deployment, DaemonSet, Job, CronJob and so on. In this chapter, we learn about these Controller in detail through practice, and discuss their features and application scenarios.
After reading the above, have you mastered the method of how to execute Job regularly? If you want to learn more skills or want to know more about it, you are welcome to follow 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.