{"slug": "monitor-kubernetes-cronjobs", "title": "Monitor Kubernetes CronJobs", "summary": "SigNoz has released a guide for monitoring Kubernetes CronJobs using its `k8s-infra` OpenTelemetry collection agent, which automatically captures pod logs and Job metrics without requiring extra configuration. The guide demonstrates creating a sample CronJob and validating telemetry data in SigNoz's Logs and Metrics Explorers, enabling users to track execution history and diagnose failures.", "body_md": "This guide shows you how to monitor Kubernetes CronJobs with the SigNoz `k8s-infra`\n\nOpenTelemetry collection agent.\n\nPrerequisites\n\n`k8s-infra`\n\nis already installed in your cluster. If you have not installed it yet, follow[Install K8s Infra](https://signoz.io/docs/opentelemetry-collection-agents/k8s/k8s-infra/install-k8s-infra/).- You have\n`kubectl`\n\naccess to the cluster where your CronJobs run. - You have a SigNoz backend available to receive telemetry.\n\nIf you already have CronJobs running in your cluster, you can skip **Step 1** and **Step 2** and go directly to ** Default telemetry from ** and\n\n`k8s-infra`\n\n**.**\n\n[Validate](#validate)Step 1. Create a CronJob\n\nApply the following manifest to create a CronJob that runs every minute and writes logs to standard output:\n\n```\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: batch-jobs\n---\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: reporting-demo\n  namespace: batch-jobs\n  labels:\n    app.kubernetes.io/name: reporting-demo\nspec:\n  schedule: \"*/1 * * * *\"\n  timeZone: \"Etc/UTC\"\n  concurrencyPolicy: Forbid\n  successfulJobsHistoryLimit: 3\n  failedJobsHistoryLimit: 1\n  jobTemplate:\n    spec:\n      template:\n        metadata:\n          labels:\n            app.kubernetes.io/name: reporting-demo\n        spec:\n          restartPolicy: OnFailure\n          containers:\n            - name: reporter\n              image: busybox:1.36\n              command:\n                - /bin/sh\n                - -c\n                - |\n                  echo \"cronjob=reporting-demo start=$(date -Iseconds)\"\n                  sleep 5\n                  echo \"cronjob=reporting-demo finished=$(date -Iseconds)\"\n```\n\nThis example keeps the CronJob simple but still uses a few Kubernetes defaults that are useful for production:\n\n`timeZone`\n\n: Makes the schedule explicit instead of relying on the controller's local time zone`concurrencyPolicy: Forbid`\n\n: Prevents overlapping runs`successfulJobsHistoryLimit`\n\nand`failedJobsHistoryLimit`\n\n: Keeps recent execution history available for debugging\n\nApply it:\n\n```\nkubectl apply -f cronjob-demo.yaml\n```\n\nStep 2. Wait for the first execution\n\nCheck that Kubernetes creates a Job and a Pod for the CronJob:\n\n```\nkubectl -n batch-jobs get cronjob,jobs,pods\n```\n\nYou should see:\n\n- The\n`reporting-demo`\n\nCronJob - A Job created from that CronJob\n- A completed Pod for that Job after the run finishes\n\nWant to see this CronJob in a single pre-built view? Skip to [Visualize with the prebuilt dashboard](#visualize-with-the-prebuilt-dashboard) once a few runs have completed.\n\nDefault telemetry from `k8s-infra`\n\nNo extra CronJob-specific Helm values are required for the default monitoring flow. If `k8s-infra`\n\nis already installed with metrics and logs collection enabled, it automatically collects CronJob pod logs and Kubernetes Job metrics when the CronJob runs.\n\nDefault logs\n\nAll logs emitted by CronJob pods are captured automatically in **Logs Explorer** with Kubernetes resource attributes such as:\n\n`k8s.namespace.name`\n\n`k8s.cronjob.name`\n\n`k8s.job.name`\n\n`k8s.pod.name`\n\nUse:\n\n`k8s.cronjob.name`\n\nto see all executions for one CronJob`k8s.job.name`\n\nto inspect one specific execution\n\nDefault metrics\n\nIn the validated `k8s-infra`\n\nsetup for this guide, these CronJob-related Kubernetes metrics were emitted by default:\n\n`k8s.cronjob.active_jobs`\n\n`k8s.job.active_pods`\n\n`k8s.job.successful_pods`\n\n`k8s.job.failed_pods`\n\n`k8s.job.desired_successful_pods`\n\n`k8s.job.max_parallel_pods`\n\nThese metrics come from the [OpenTelemetry k8sclusterreceiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/k8sclusterreceiver/documentation.md). They are attached to Kubernetes Job resources, so `k8s.job.name`\n\nis the main dimension to use when you want to inspect one CronJob run in **Metrics Explorer**.\n\nValidate\n\nValidate logs in SigNoz\n\nOpen **Logs Explorer** and filter with these resource attributes:\n\n`k8s.cluster.name = <your-cluster-name>`\n\n`k8s.namespace.name = batch-jobs`\n\n`k8s.cronjob.name = reporting-demo`\n\nReplace `<your-cluster-name>`\n\nwith the `clusterName`\n\nyou set when you installed `k8s-infra`\n\n.\n\nYou should see log lines from every run of the CronJob.\n\nUse `k8s.job.name`\n\nwhen you want to inspect one specific execution, because Kubernetes creates a new Job name for every schedule.\n\nValidate metrics in SigNoz\n\nOpen **Metrics Explorer** and query one or more of these metrics:\n\n`k8s.job.active_pods`\n\n`k8s.job.successful_pods`\n\n`k8s.job.failed_pods`\n\n`k8s.job.desired_successful_pods`\n\n`k8s.job.max_parallel_pods`\n\n`k8s.cronjob.active_jobs`\n\nFilter with:\n\n`k8s.cluster.name = <your-cluster-name>`\n\n`k8s.namespace.name = batch-jobs`\n\nReplace `<your-cluster-name>`\n\nwith the `clusterName`\n\nyou set when you installed `k8s-infra`\n\n.\n\nGroup by `k8s.job.name`\n\nto see each CronJob execution separately.\n\nVisualize with the prebuilt dashboard\n\n[Visualize with the prebuilt dashboard](#visualize-with-the-prebuilt-dashboard)\n\nSigNoz publishes a prebuilt **Kubernetes CronJobs** dashboard that uses the same metrics this guide validates. It shows current Job state and recent Job runs in one view, with cluster, namespace, Job, and CronJob filters.\n\n- Dashboard reference page:\n[Kubernetes CronJobs Dashboard](https://signoz.io/docs/dashboards/dashboard-templates/kubernetes-cronjobs/) - Direct JSON:\n`k8s-infra-metrics/kubernetes-cronjobs.json`\n\nTo use it, open **Dashboards** in SigNoz, click **New Dashboard**, choose **Import JSON**, and paste the JSON from the link above.\n\nLimit log collection to CronJob namespace (Optional)\n\n[Limit log collection to CronJob namespace (Optional)](#limit-log-collection-to-cronjob-namespace-optional)\n\nPrefer namespace-based filters for CronJobs. Pod names and Job names change on every run, so namespace rules are easier to maintain.\n\nOnly collect logs from your CronJob namespace\n\nIf you keep CronJobs in a dedicated namespace, enable a whitelist for that namespace:\n\n```\npresets:\n  logsCollection:\n    whitelist:\n      enabled: true\n      namespaces:\n        - batch-jobs\n```\n\nApply the updated values to your existing release:\n\n```\nhelm upgrade <release-name> signoz/k8s-infra -n <namespace> -f override-values.yaml\n```\n\nVerify these values:\n\n`<release-name>`\n\n: Your existing`k8s-infra`\n\nHelm release name`<namespace>`\n\n: The namespace where`k8s-infra`\n\nis installed\n\nExclude noisy namespaces from log collection\n\nIf shared cluster namespaces create too much log noise, exclude them:\n\n```\npresets:\n  logsCollection:\n    blacklist:\n      enabled: true\n      namespaces:\n        - kube-system\n        - default\n```\n\nApply the updated values to your existing release:\n\n```\nhelm upgrade <release-name> signoz/k8s-infra -n <namespace> -f override-values.yaml\n```\n\nVerify these values:\n\n`<release-name>`\n\n: Your existing`k8s-infra`\n\nHelm release name`<namespace>`\n\n: The namespace where`k8s-infra`\n\nis installed\n\nTroubleshooting\n\n[Troubleshooting](#troubleshooting)\n\nI can see logs, but I do not see Job metrics\n\nVerify that the cluster-level `k8s-infra`\n\ncollector deployment is running. The Job metrics in this guide came from the cluster-level collector, not from the node-level daemon.\n\nFor example, check the `k8s-infra`\n\nnamespace where you installed the chart:\n\n```\nkubectl get deployments -n <k8s-infra-namespace>\nkubectl get pods -n <k8s-infra-namespace>\n```\n\nYou should see a running deployment such as `k8s-infra-k8s-cluster-otel-agent`\n\nwith pods in `Running`\n\nstatus. If the deployment is missing, re-install `k8s-infra`\n\nby following [Install K8s Infra](https://signoz.io/docs/opentelemetry-collection-agents/k8s/k8s-infra/install-k8s-infra/).\n\nI can see Job metrics, but I do not see CronJob logs\n\nCheck these points:\n\n`presets.logsCollection.enabled`\n\nis still enabled in your`k8s-infra`\n\nvalues- Your namespace is not excluded by a\n`logsCollection.blacklist`\n\nrule - The CronJob container writes logs to standard output or standard error\n\nMy Job names keep changing on every run\n\nThat is expected Kubernetes behavior. A CronJob creates a new Job for every scheduled execution.\n\nUse:\n\n`k8s.cronjob.name`\n\nin**Logs Explorer** to see all runs for one CronJob`k8s.job.name`\n\nin**Metrics Explorer** or**Logs Explorer** to inspect one specific execution\n\nNext steps\n\n[Use Logs Explorer](https://signoz.io/docs/product-features/logs-explorer/)to search CronJob executions across namespaces and filter by`k8s.cronjob.name`\n\n[Use Query Builder](https://signoz.io/docs/userguide/query-builder/)to group CronJob metrics by`k8s.job.name`\n\nand compare recent runs[Set up alerts](https://signoz.io/docs/setup-alerts-notification/)to notify on failed CronJob runs or missing expected executions", "url": "https://wpnews.pro/news/monitor-kubernetes-cronjobs", "canonical_source": "https://signoz.io/docs/opentelemetry-collection-agents/k8s/k8s-infra/user-guides/k8s-cronjobs", "published_at": "2026-05-27 00:00:00+00:00", "updated_at": "2026-05-27 13:26:48.563919+00:00", "lang": "en", "topics": ["ai-tools", "ai-infrastructure", "mlops"], "entities": ["SigNoz", "Kubernetes", "CronJob", "OpenTelemetry", "k8s-infra"], "alternates": {"html": "https://wpnews.pro/news/monitor-kubernetes-cronjobs", "markdown": "https://wpnews.pro/news/monitor-kubernetes-cronjobs.md", "text": "https://wpnews.pro/news/monitor-kubernetes-cronjobs.txt", "jsonld": "https://wpnews.pro/news/monitor-kubernetes-cronjobs.jsonld"}}