Questions tagged [kubernetes-cronjob]

301 questions
11
votes
2 answers

GKE does not scale to/from 0 when autoscaling enabled

I want to run a CronJob on my GKE in order to perform a batch operation on a daily basis. The ideal scenario would be for my cluster to scale to 0 nodes when the job is not running and to dynamically scale to 1 node and run the job on it every time…
10
votes
3 answers

Kubernetes Cronjob schedule in local timezone (custom timezone) as it always UTC

I want to schedule kubernetes cronjob in my local timezone (GMT+7), currently when I schedule cronjob in k8s I need to schedule in UTC but I want to schedule in my local timezone, As specify in Kubernetes document, that I need to change timezone in…
9
votes
1 answer

Kubernetes CronJob multiple schedule times

I want to run one cron at different times. Is it possible to do something like this in my YML file: apiVersion: batch/v1beta1 kind: CronJob metadata: name: my-cronjob spec: schedule: - "*/10 00-08 * * *" - "*/5 09-18 * * *" - "*/10…
Tomas Lukac
  • 1,923
  • 2
  • 19
  • 37
9
votes
1 answer

Manually start a Kubernetes CronJob

For a deployed Kubernetes CronJob named foo, how can I manually run it immediately? This would be for testing or manual runs outside its configured schedule.
Dan Tanner
  • 2,229
  • 2
  • 26
  • 39
9
votes
2 answers

Kubernetes CronJob - Skip job if previous is still running AND wait for the next schedule time

I have scheduled the K8s cron to run every 30 mins. If the current job is still running and the next cron schedule has reached it shouldn't create a new job but rather wait for the next schedule. And repeat the same process if the previous job is…
k_vishwanath
  • 1,326
  • 2
  • 20
  • 28
8
votes
1 answer

How do I make sure my cronjob job does NOT retry on failure?

I have a Kubernetes Cronjob that runs on GKE and runs Cucumber JVM tests. In case a Step fails due to assertion failure, some resource being unavailable, etc., Cucumber rightly throws an exception which leads the Cronjob job to fail and the…
8
votes
2 answers

Is this possible to schedule CronJob to execute on each of Kubernetes nodes?

What I would like to do is to run some backup scripts on each of Kubernetes nodes periodically. I want it to run inside Kubernetes cluster in contrast to just adding script to each node's crontab. This is because I will store backup on the volume…
Daniel Szot
  • 93
  • 1
  • 7
7
votes
1 answer

Kubernetes Cronjob: Reset missed start times after cluster recovery

I have a cluster that includes a Cronjob scheduled to run every 5 minutes. We recently experienced an issue that incurred downtime and required manual recovery of the cluster. Although now healthy again, this particular cronjob is failing to run…
duncanhall
  • 11,035
  • 5
  • 54
  • 86
7
votes
3 answers

How to verify a cronjob successfully completed in Kubernetes

I am trying to create a cronjob that runs the command date in a single busybox container. The command should run every minute and must complete within 17 seconds or be terminated by Kubernetes. The cronjob name and container name should both be…
O.Man
  • 585
  • 2
  • 9
  • 20
7
votes
2 answers

Kubernetes jobs and back-off limit values: is the value a number of retries or minutes?

I was reading the Kubernetes documentation about jobs and retries. I found this: There are situations where you want to fail a Job after some amount of retries due to a logical error in configuration etc. To do so, set .spec.backoffLimit to…
Dherik
  • 17,757
  • 11
  • 115
  • 164
6
votes
3 answers

Kubernetes show Cron Job Successfully but when not getting desired result

when I run the cronjob into Kubernetes, that time cron gives me to success the cron but not getting the desired result apiVersion: batch/v1beta1 kind: CronJob metadata: name: {{ $.Values.appName }} namespace: {{ $.Values.appName }} spec: …
Parth Shah
  • 705
  • 6
  • 14
6
votes
0 answers

Swagger multiple definitions best practices

I have an API, and a consumer web app, both written in Node and Express. The API is defined by a OpenAPI Specification. Implemented by swagger-ui-express. The above web apps are Dockerised and managed in Kubernetes. The API has a handful of…
6
votes
3 answers

Handling cronjobs in a Pod with multiple containers

I have a requirement in which I need to create a cronjob in kubernetes but the pod is having multiple containers (with single container its working fine). Is it possible? The requirement is something like this: 1. First container: Run the shell…
5
votes
1 answer

Can manually triggered cron jobs respect the concurrencyPolicy?

So I've a cron job like this: apiVersion: batch/v1beta1 kind: CronJob metadata: name: my-cron-job spec: schedule: "0 0 31 2 *" failedJobsHistoryLimit: 3 successfulJobsHistoryLimit: 1 concurrencyPolicy: "Forbid" startingDeadlineSeconds:…
natschz
  • 1,007
  • 10
  • 23
5
votes
2 answers

kubernetes-client javascript - create job from cronjob

What will be the equivalent for creating a job: kubectl -n my-ns create job --from=cronjob/my-cron-job my-job using javascript kubernetes-client ?
AsafG
  • 136
  • 1
  • 9
1
2
3
20 21