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
7,420 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,350 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,520 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
8,010 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,350 points
9,030 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,350 points
3,136 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,778 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
15,577 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,062 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,350 points
1,048 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,350 points
4,832 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