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,110 points
480 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
• 42,510 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
• 16,630 points
0 votes
kubectl patch <backup-cronjob> -p '{"spec":{"schedule": "0 0 * * 0"}}
answered Jun 20 by sudhams reddy duba
What's the -p for?
-p --> --patch

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,280 points
1,060 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
• 42,510 points
1,239 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
• 42,510 points
125 views
+1 vote
4 answers
0 votes
1 answer
0 votes
3 answers

Error while joining cluster with node

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

answered Jan 17 in Others by anonymous
3,077 views
+3 votes
1 answer
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
• 42,510 points
130 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
• 42,510 points
890 views