Change the schedule of Kubernetes cron job

0 votes
I have a cron job in my kubernetes which is scheduled to fetch data every month. I want to reschedule this job, so that it fetches the data every week.

Is therea way to do the same?
Sep 18, 2018 in Kubernetes by lina
• 8,220 points
6,635 views

3 answers to this question.

0 votes

If you're looking for a one line command, you can use this command:

kubectl patch my-cronjob -p '{"spec":{"schedule": "42 11 * * *"}}
answered Sep 18, 2018 by Kalgi
• 52,360 points
0 votes

Hey @Lina, You can use the keyword patch to update only the selected fields of resource.

$patch -h                   
Update field(s) of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.           

JSON and YAML formats are accepted.

answered Sep 18, 2018 by Hannah
• 18,570 points
0 votes
kubectl patch <backup-cronjob> -p '{"spec":{"schedule": "0 0 * * 0"}}
answered Jun 21, 2019 by sudhams reddy duba
What's the -p for?
-p --> --patch
You also need to mentionthe object type that you want to patch, like:

kubectl patch cronjob <cron-job-name> -p '{"spec": {"schedule": "* * * * *"}'

Related Questions In Kubernetes

0 votes
1 answer

Increasing the shm size of a kubernetes container

You cannot achieve this in kubernetes pod. READ MORE

answered Sep 12, 2018 in Kubernetes by ajs3033
• 7,300 points
7,490 views
0 votes
1 answer

Kubernetes cron job call curl in loop

It's a small silly mistake: dollar sign $ should be ...READ MORE

answered Sep 17, 2018 in Kubernetes by Kalgi
• 52,360 points
8,503 views
0 votes
1 answer

How to fail a (cron) job after a certain number of retries?

You're trying to set 3 asbackoffLimit of your Job. ...READ MORE

answered Sep 17, 2018 in Kubernetes by Kalgi
• 52,360 points
2,782 views
+1 vote
4 answers

Execute shell script file using kubernetes as a cron job

use /bin/sh instead of /bin/bash This solved it ...READ MORE

answered May 7, 2019 in Kubernetes by Sid
17,031 views
+1 vote
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17, 2019 in Others by anonymous
14,593 views
+4 votes
1 answer

Installing Web UI (Dashboard):kubernetes-dashboard on main Ubuntu 16.04.6 LTS (Xenial Xerus) server

Follow these steps: $ kubeadm reset $ kubeadm init ...READ MORE

answered Apr 12, 2019 in Kubernetes by Kalgi
• 52,360 points

reshown Apr 12, 2019 by Kalgi 6,077 views
0 votes
1 answer

Spark job using kubernetes instead of yarn

I should be in the format of ...READ MORE

answered Sep 6, 2018 in Kubernetes by Kalgi
• 52,360 points
791 views
0 votes
1 answer

Connect to existing pod, execute script, disconnect - Kubernetes cron job

As far as i know there's no ...READ MORE

answered Sep 17, 2018 in Kubernetes by Kalgi
• 52,360 points
4,499 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP