Questions tagged [kubernetes-cronjob]
301 questions
1
vote
1 answer
How to prevent Kubernetes cronjob running concurrently when I trigger it manually?
I have set the Kubernetes cronJob to prevent concurrent runs like here using parallelism: 1, concurrencyPolicy: Forbid, and parallelism: 1. However, when I try to create a cronJob manually I am allowed to do that.
$ kubectl get cronjobs
...
$…

Felipe
- 7,013
- 8
- 44
- 102
1
vote
1 answer
Can I set specific env variable to only one of the Pods within a deployment with multiple replicas?
I have a deployment of my backend app which has 6 replicas. In the code of the app, I have a node.js cronjob running every minute. But the problem is that because I have 6 replicas, it runs 6 times in parallel. I want to send env variable to exactly…

Raz Buchnik
- 7,753
- 14
- 53
- 96
1
vote
1 answer
Kubernetes concurrencyPolicy Forbid not preventing concurrent jobs
I have a backup job running, scheduled to run every 24 hours. I have the concurrency policy set to "Forbid." I am testing my backup, and I create jobs manually for testing, but these tests are not forbidding concurrent runs. I use:
kubectl create…

macetw
- 1,640
- 1
- 17
- 26
1
vote
2 answers
Trigger Kubernetes/EKS cron job via HTTP call
I have bunch of cron jobs that sit in an EKS cluster and would like to trigger them via HTTP call. Does such API exist from Kubernetes? If not, what else can be done?

learningisfun
- 131
- 1
- 5
1
vote
2 answers
Kubernetes CronJob only runs the same job even though other jobs are waiting in limited number of pods per node condition
I'd like to know how kubernetes CronJob chooses the job to run when there are multiple waiting jobs.
It is not FIFO, but LIFO?
Here is the settings of my experiment.
Kubernetes Server Version 1.21.5
1 node in kubernetes cluster
limit 3 pods per…

musasabi
- 21
- 3
1
vote
1 answer
cronjob can't delete failed pod
I have a cronjob which run once every midnight, however one day I deployed wrong version of it and consequently the pod it made went failed soon.
So.. the problem is when I delete the failed pod the cronjob immediately recreates it. How can I stop…

0xF4D3C0D3
- 747
- 1
- 5
- 15
1
vote
1 answer
how to start rails rake tasks in kubernetes cron job
We are deploying a Rails application on Kubernetes.
The assets:precompile task run as part of the Docker image build process.
We want to run rake tasks like rake db:migrate task and other tasks on each deployment.
Current solution, we are using…

karlos
- 807
- 1
- 8
- 38
1
vote
1 answer
How to clean by cronjob all logs file of mongoDB in kubernetes?
I have an app that works by deployment service and communicates with the world with Nginx-Ingress-controller.
This app is connected to the MongoDB database.
I asked to create a cronjob that purges all MongoDB logs once daily at midnight.
"Add a…

korenlios
- 11
- 2
1
vote
1 answer
Cronjob with sidecar logging container no exit code
Cronjob needs exit code to make the job successful or failed but with sidecar container an example the log container keep running and there is no exit code, even the job of the main container might run successfully the final state remain failed.…

Hamid Zorgani
- 31
- 3
1
vote
3 answers
Which Kubernetes Object manages Job and CronJob workloads?
All Jobs and CronJobs ultimately run as Pods. Apart from stand alone pods other pods are managed by deployments/replicasets. But for Job and CronJob I don't see any deployment or ReplicaSet though the job/cronjob pods have same nomenclature as of a…

Aditya Bhuyan
- 328
- 6
- 10
1
vote
1 answer
Kubernetes CronJob Not exited
I am running a cronjob in kubernetes. Cronjob started and but not exited. Status of pod is always in RUNNING.
Below is logs
kubectl get pods
cronjob-1623253800-xnwwx 1/1 Running 0 13h
When i describe the JOB below are…

galiylama
- 45
- 2
- 7
1
vote
1 answer
Using the rollout restart command in cronjob, in GKE
I want to periodically restart the deployment using k8s cronjob.
Please check what is the problem with the yaml file.
When I execute the command from the local command line, the deployment restarts normally, but it seems that the restart is not…

nightshiftman
- 71
- 1
- 5
1
vote
1 answer
getting a No such file or directory error with Kubernetes cronjob and dockerfile
I have a script that I want to run using a dockerfile that looks like this:
FROM debian:unstable-slim
RUN apt-get update && apt-get install -y netcat-traditional httpie postgresql-client
COPY go.sh /tmp/go.sh
WORKDIR /tmp
CMD ["bash", "-c",…

anfbar
- 99
- 2
- 12
1
vote
1 answer
Running Kubernetes cronjob on a dedicated pod
I have an API as a Kubernetes service, and I need to run an endpoint in the API every hour. (heavy statistic calculation, takes around 3-5 minutes)
Currently I am using curl to call the end point directly:
containers:
- name: callout
image:…

dvdmn
- 6,456
- 7
- 44
- 52
1
vote
1 answer
Keep getting error status on Kubernetes Cron Job with connection refused?
I am trying to write a cron job which hits a rest endpoint of the application it is pulling image of.
Below is the sample code:
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: {{ .Chart.Name }}-cronjob
labels:
app: {{…

anzie001
- 231
- 3
- 12