BotPings: AI Agent Alerts
Download on the App Store
Download on the App Store

Check in from a Kubernetes CronJob

Monitor a Kubernetes CronJob with BotPings. Keep the check-in URL in a Secret and report success or failure when your scheduled container exits.

Kubernetes · 5 min · Servers and scripts

Before you start

Create a check-in in BotPings with a deadline after the job normally finishes. Use a namespace you can administer. Your job image needs a shell and curl.

Steps

Store the private URL in a Secret

Save only the check-in URL to a protected file named check-in-url in your working directory. Use the namespace that will run the CronJob.

Shell
kubectl create secret generic botpings-check-in   --from-file=BOTPINGS_CHECK_IN_URL=./check-in-url

Wrap the workload

Save this as backup-cronjob.yaml. Replace the image and /app/backup.sh with your own job. Match schedule and timeZone to your check-in settings.

YAML
apiVersion: batch/v1
kind: CronJob
metadata:
  name: monitored-backup
spec:
  schedule: "0 3 * * *"
  timeZone: America/Chicago
  concurrencyPolicy: Forbid
  jobTemplate:
    spec:
      backoffLimit: 0
      template:
        spec:
          restartPolicy: Never
          containers:
            - name: backup
              image: example.com/backup:1
              imagePullPolicy: IfNotPresent
              env:
                - name: BOTPINGS_CHECK_IN_URL
                  valueFrom:
                    secretKeyRef:
                      name: botpings-check-in
                      key: BOTPINGS_CHECK_IN_URL
              command: ["/bin/sh", "-ec"]
              args:
                - |
                  if /app/backup.sh; then
                    curl -fsS --max-time 15 "$BOTPINGS_CHECK_IN_URL"
                  else
                    status=$?
                    curl -fsS --max-time 15 "$BOTPINGS_CHECK_IN_URL/fail" || true
                    exit "$status"
                  fi

Apply the CronJob

Confirm the current kubectl context and namespace before applying the manifest.

Shell
kubectl apply -f backup-cronjob.yaml

Test it

Run one disposable job from the CronJob. After a successful exit, check Last check-in in BotPings. Test a failing command on a separate demo run and confirm the failure alert.

Shell
kubectl create job --from=cronjob/monitored-backup monitored-backup-test
kubectl wait --for=condition=complete job/monitored-backup-test --timeout=120s
The Database backup source showing its nightly schedule and check-in status.

If it doesn’t work

  • The Pod did not start. Inspect Job and Pod events. Confirm the Secret exists in the same namespace and the image can be pulled.
  • The backup succeeded but the check-in didn’t arrive. Verify egress from the Pod and the check-in URL.
  • The job runs at the wrong time. Compare the CronJob’s timeZone and schedule with the check-in deadline.

Related guides

Checked with a local Kubernetes CronJob and BotPings 1.0, November 2026.