Overview and install
The agent runs in your cluster, discovers your CronJobs and reports when their Jobs start, succeed or fail, and why. You do not add ping calls to your CronJobs.
The agent is a plan feature (Free: none, Pro: 1 cluster, Enterprise: 10 clusters), see Plans and limits.
What is it for
Section titled “What is it for”Kubernetes CronJobs fail in ways a ping cannot see: the pod is OOMKilled, the image cannot be pulled, the CronJob is
suspended or deleted. The agent watches the cluster from inside and tells CronBeat, so you get the failure reason
without editing any CronJob.
When to use it
Section titled “When to use it”On Pro or Enterprise, when you run CronJobs and want them discovered and monitored automatically. For one or two jobs, or on Free, the manual ping method works too.
What it does
Section titled “What it does”- On start and then every 5 minutes it sends the full list of CronJobs (namespace, name, uid, schedule, time zone, suspend flag) to CronBeat.
- For every CronJob CronBeat creates a monitor (one per
<namespace>/<name>) with the cron schedule and a default grace period of 600 seconds. Created monitors count toward your monitor limit. When the limit is reached, no new monitors are created and the sync response carries a warning. - A CronJob with
suspend: truepauses its monitor, un-suspending resumes it. A CronJob that disappears from the cluster is not deleted in CronBeat, its monitor is paused. - For every Job that belongs to a CronJob (
ownerReferencesof kindCronJob; other Jobs are ignored) it sendsjob_startedwhen the Job is created,job_succeededwhen it completes (with the duration) andjob_failedwhen it fails (with a reason and a message). CronBeat turns these into start, success and fail pings. - Every 60 seconds it sends a heartbeat.
- Optional annotations on a CronJob set its grace period and maximum runtime or leave it out, see Configure a CronJob with annotations.
Security model
Section titled “Security model”The complete list of permissions and data is on Agent permissions and data.
- Read-only RBAC. The chart creates a ClusterRole with only
listandwatchoncronjobsandjobs(batch) and onpods(core). No access to Secrets or pod logs, no write permissions. - Outbound only. The agent makes HTTPS requests to the CronBeat API. It listens on one port (
healthPort, default 8081) for the liveness and readiness probes only and creates no Service. - The pod runs as non-root with a read-only root filesystem, without privilege escalation and with all capabilities dropped.
- The API key is read from a Kubernetes Secret and only sent in the
Authorizationheader. CronBeat stores a hash of it. - What leaves the cluster: CronJob metadata (namespace, name, uid, schedule, time zone, suspend) and Job events (job
uid, timestamps, duration, failure reason and a short message such as
container backup terminated: OOMKilled (exit code 137, memory limit 256Mi)). Of the pod spec only the memory limit of each container is read. Environment variables, images, commands and container logs are never read or sent. The message Kubernetes gives for a waiting container (for examplesecret "db-credentials" not found) is included in the failure message: it can contain the name of a Secret or an image, never a value. - With
watchNamespacesset the agent only watches those namespaces and the chart creates a Role per namespace instead of a ClusterRole, so it has no cluster-wide access.
Requirements
Section titled “Requirements”- Kubernetes 1.27 or newer (the chart requires it, CronJob
spec.timeZoneis used). - Outbound HTTPS from the cluster to
api.cronbeat.dev. - An agent API key. Create it in the app under Agents: enter the cluster name and copy the key
(it starts with
cb_agent_and is shown once).
Configure a CronJob with annotations
Section titled “Configure a CronJob with annotations”Put these on the CronJob (metadata.annotations) to keep the monitor settings next to your manifest:
| Annotation | Value | Effect |
|---|---|---|
cronbeat.dev/grace |
90 (seconds), 10m, 1h30m or 2d; 1 second to 7 days |
Grace period of the monitor. Default: 10 minutes |
cronbeat.dev/max-runtime |
Same formats; 1 second to 24 hours | A run longer than this is reported as too long |
cronbeat.dev/ignore |
true |
CronJob is not monitored. An existing monitor is paused |
apiVersion: batch/v1kind: CronJobmetadata: name: nightly-backup annotations: cronbeat.dev/grace: "15m" cronbeat.dev/max-runtime: "2h"- An invalid value is ignored and shown in the agent log, nothing else is affected.
- While an annotation is present the agent sets the value on every sync, so a change you make in the app is replaced. Removing an annotation leaves the monitor as it is; change it in the app if you want another value.
- Changes are picked up within seconds.
Update the agent
Section titled “Update the agent”The Agents page shows the version each agent reports. When a newer version is published, the agent gets an
Update available badge and the page shows the exact command for each agent that is behind. For an agent installed with the
command from the app (release cronbeat-agent-<cluster>, namespace cronbeat-agent) it looks like this:
helm upgrade cronbeat-agent-prod-eu cronbeat-agent --repo https://repo.repsy.io/nuricanozturk/cronbeat-agent --namespace cronbeat-agent --reset-then-reuse-valuesIf you installed the agent another way, find the release name and namespace first and put them in the same command:
helm list --all-namespaces | grep cronbeat-agentRELEASE and NAMESPACE in a template command are placeholders: use the real names from that list. A name such as
RELEASE is refused by Helm (release name is invalid). --reset-then-reuse-values keeps what you set at install time (API
key, cluster name, watched namespaces) and takes new defaults from the chart. The pod restarts with the new image; events of a
Job that finishes during the restart are sent when the agent is back. The version on the page updates after the next
heartbeat. Do this once per agent.
Several agents in one cluster
Section titled “Several agents in one cluster”To split a cluster (for example one agent for the namespace gitnode), install one agent per part. Each agent needs its
own cluster name and its own Helm release name. The command in the app names the release after the cluster
(cronbeat-agent-gitnode), so the commands do not collide. Do not let two agents watch the same namespace: you would
get every CronJob twice and every alert twice.
Agent monitors in the list
Section titled “Agent monitors in the list”Monitors the agent creates sit in the same Monitors list as your ping and HTTP monitors, with the label Kubernetes · cluster-name under the name. Once you have more than one kind of monitor, tabs appear above the list: All, Ping, HTTP checks and Kubernetes, each with its count. On the Kubernetes tab, with two or more clusters, you can narrow the list to one cluster. The tab and cluster are kept in the address, so you can bookmark a view.
Install with Helm
Section titled “Install with Helm”helm install cronbeat-agent-prod-eu cronbeat-agent --repo https://repo.repsy.io/nuricanozturk/cronbeat-agent \ --namespace cronbeat-agent --create-namespace \ --set apiKey=cb_agent_... \ --set clusterName=prod-euTo keep the key in a Secret that you manage yourself:
kubectl create namespace cronbeat-agentkubectl -n cronbeat-agent create secret generic cronbeat-agent-key --from-literal=api-key=cb_agent_...helm install cronbeat-agent-prod-eu cronbeat-agent --repo https://repo.repsy.io/nuricanozturk/cronbeat-agent -n cronbeat-agent \ --set existingSecret=cronbeat-agent-key --set clusterName=prod-euWatch only some namespaces
Section titled “Watch only some namespaces”By default the agent watches every namespace. In the app, type the namespace names (separated by commas) into the Namespaces (optional) field above the install command and the command is rewritten for you. To do it by hand, list the namespaces:
helm install cronbeat-agent-prod-eu cronbeat-agent --repo https://repo.repsy.io/nuricanozturk/cronbeat-agent -n cronbeat-agent --create-namespace \ --set apiKey=cb_agent_... --set clusterName=prod-eu \ --set 'watchNamespaces={team-a,team-b}'The chart then creates a Role and RoleBinding in each listed namespace instead of a cluster wide ClusterRole, so the agent has no access to anything else.
Two things to know:
- The CronJob list the agent sends is treated as complete for that cluster name. CronJobs that are no longer in it get their monitors paused. If you narrow
watchNamespaceslater, the monitors of the namespaces you dropped are paused. - Do not run two agents with the same cluster name to split namespaces between them: each would pause the other’s monitors. Give every agent its own cluster name (for example
prod-eu-team-a).
Check that it runs:
kubectl -n cronbeat-agent rollout status deploy/cronbeat-agent-prod-eukubectl -n cronbeat-agent logs deploy/cronbeat-agent-prod-euThe Deployment name is derived from the release name; use kubectl -n cronbeat-agent get deploy if yours differs.
Values
Section titled “Values”| Key | Default | Description |
|---|---|---|
clusterName |
(required) | Cluster name. The server uses the cluster name registered with the key. |
apiKey |
"" |
Agent API key, stored in a Secret created by the chart. |
existingSecret |
"" |
Name of your own Secret that holds the key (instead of apiKey). |
existingSecretKey |
api-key |
Key inside existingSecret. |
apiUrl |
https://api.cronbeat.dev |
CronBeat API base URL. |
watchNamespaces |
[] |
Namespaces to watch, empty means all. |
healthPort |
8081 |
Port of the /healthz and /readyz probes. |
goMemLimit |
200MiB |
Go soft memory limit, keep about 20% below the memory limit. |
logLevel |
info |
debug, info, warn or error. |
image.repository |
repo.repsy.io/nuricanozturk/cronbeat-agent-bin/agent |
Override it to use your own mirror. |
image.tag |
chart appVersion |
Image tag. |
image.pullPolicy |
IfNotPresent |
|
imagePullSecrets |
[] |
|
resources |
20m / 64Mi requests, 200m / 256Mi limits | Raise the memory limit for clusters with many thousands of pods. |
nodeSelector, tolerations, affinity |
empty | Scheduling. |
podAnnotations, podLabels |
empty | |
serviceAccount.create, .name, .annotations |
true, release name, empty |
|
nameOverride, fullnameOverride |
empty |
clusterName is required, and one of apiKey or existingSecret must be set.
Delivery guarantees and limits
Section titled “Delivery guarantees and limits”- Events are queued in memory and are not persisted. An event still queued when the pod dies is lost.
- After a restart the agent re-sends events of Jobs that still exist, but skips events older than one hour so cluster history is not replayed. CronBeat de-duplicates by job uid and event type.
- Failed deliveries are retried with backoff on network errors,
5xxand429. Other4xxresponses are not retried. - One replica, no leader election. Running two would not corrupt data but would double the traffic.
- If a Job’s pod was created and removed while the agent was not running, the container level reason cannot be recovered. Only the reason on the Job itself is available.
What happens when
Section titled “What happens when”| Situation | Result |
|---|---|
| You create a new CronJob | Within 5 minutes (next sync) a monitor with its cron schedule appears. |
A Job fails with OOMKilled |
The monitor goes down at once with the reason and message in the alert. |
| You suspend a CronJob | Its monitor is paused. Un-suspending resumes it. |
| You delete a CronJob | Its monitor is not deleted, it is paused. |
| The agent is silent for 3 minutes | One agent_lost incident opens, the monitors of that cluster are not judged meanwhile, see Failure reasons and agent loss. |
| The plan allows fewer agents | Only the oldest agents that fit the new limit keep working, the others get 401 (Free: none). Nothing is deleted. |
| You revoke an agent key | The agent gets 401. A revoked agent can be deleted permanently in the app. |
| The plan monitor limit is reached | No new monitors are created and the sync reports a warning. |

