<p>Kubernetes CronJobs do not natively support readiness probes as they are designed for short-lived, one-off tasks. However, you can add an init container to check prerequisites before the main container runs. The init container can perform readiness checks, such as verifying dependencies or network conditions. If the init container completes successfully, the main container (your CronJob task) will run. This approach mimics readiness probes for CronJobs by ensuring the environment is ready before executing the actual task. This way, you can achieve a pre-run check similar to readiness probes for short-lived containers.</p>

CC BY-SA 4.0
2024-09-02T18:38:40.037Z
The devops community hasn't exactly voiced their opinion as to whether we want AI generated content on the site.  I'm not going to delete this post right away, but I will put a post notice on it because so you can do the work of finding citations.
Peter Turner
CC BY-SA 4.0
2024-09-02T09:27:38.767Z
2024-09-02T09:27:38.767Z
evabrown2508
<p>The &quot;readiness probe&quot; is for determining whether the pod can receive traffic from the cluster.  Cronjobs aren't intended to receive traffic from the cluster, so a readiness probe is pointless.</p>
<p>I'm having trouble correlating your subject line with the content of your question.</p>
<p>It is pointless to check if a container is &quot;ready to run&quot; for a cronjob. The container is not created until the cronjob instance is run according to the schedule.</p>

CC BY-SA 4.0
2023-12-07T02:48:07.433Z
That's kinda what I figured, the problem is the cronjob may have problems that prevent it from being ready to run.  It's not necessarily pointless, to me at least, just definitely not how Kubernetes was designed.
Peter Turner
CC BY-SA 4.0
2023-12-06T22:36:11.160Z
2023-12-06T22:36:11.160Z
David M. Karr
<p>If I am starting a container in Kubernetes and I want to run it as a cronjob, is there a way that I can tell that the containers is ready to be ran?  I have a collection of short-lived containers instead of background services. I'd like something that'd test it, prior to run, similar to how readiness probes work for services.</p>

<kubernetes>
Do Kubernetes cron jobs have readiness and/or liveness probes?
Peter Turner
# Do Kubernetes cron jobs have readiness and/or liveness probes?

(Asked by: username_0 on 2023-12-06)

If I am starting a container in Kubernetes and I want to run it as a cronjob, is there a way that I can tell that the containers is ready to be ran? I have a collection of short-lived containers instead of background services. I'd like something that'd test it, prior to run, similar to how readiness probes work for services.

**Tags:** kubernetes


---

## 2 answers

### Answer by username_1 on 2024-09-02. Score: 0

Kubernetes CronJobs do not natively support readiness probes as they are designed for short-lived, one-off tasks. However, you can add an init container to check prerequisites before the main container runs. The init container can perform readiness checks, such as verifying dependencies or network conditions. If the init container completes successfully, the main container (your CronJob task) will run. This approach mimics readiness probes for CronJobs by ensuring the environment is ready before executing the actual task. This way, you can achieve a pre-run check similar to readiness probes for short-lived containers.

> **Comments:**
> **username_0**: The devops community hasn't exactly voiced their opinion as to whether we want AI generated content on the site.  I'm not going to delete this post right away, but I will put a post notice on it because so you can do the work of finding citations.  

---

### Answer by username_2 on 2023-12-06. Score: 0

The "readiness probe" is for determining whether the pod can receive traffic from the cluster. Cronjobs aren't intended to receive traffic from the cluster, so a readiness probe is pointless.

I'm having trouble correlating your subject line with the content of your question.

It is pointless to check if a container is "ready to run" for a cronjob. The container is not created until the cronjob instance is run according to the schedule.

> **Comments:**
> **username_0**: That's kinda what I figured, the problem is the cronjob may have problems that prevent it from being ready to run.  It's not necessarily pointless, to me at least, just definitely not how Kubernetes was designed.  

---

