For the complete documentation index, see llms.txt. Markdown versions are available by appending .md to documentation URLs.

Collect Kubernetes Kubelet Logs with OpenTelemetry in SigNoz

SigNoz Cloud - This page applies to SigNoz Cloud editions.
Self-Host - This page applies to self-hosted SigNoz editions.

Overview

The kubelet is the agent on each Kubernetes node that starts pods, runs health checks, and talks to the container runtime. Its logs explain node-level failures, such as image pull errors and failed volume mounts. You add an OpenTelemetry Collector receiver to the K8s Infra collection agent, and the agent sends the kubelet logs of every node to SigNoz. Most nodes write kubelet logs to the systemd journal. RKE2 nodes write them to a file, and the RKE2 section covers that setup.

Prerequisites

  • The K8s Infra collection agent on Linux nodes, installed with the Helm CLI or with Foundry. See the install guide.

Send kubelet logs to SigNoz

Step 1. Find where the kubelet writes its logs

Run this on a node, as root or with sudo:

sudo journalctl -u kubelet -n 5 --no-pager

If the command prints kubelet log lines, the kubelet writes to the systemd journal. Continue with Step 2.

If the command prints -- No entries -- and the node runs RKE2, the kubelet writes to /var/lib/rancher/rke2/agent/logs/kubelet.log. Follow Collect kubelet logs on RKE2 instead of Step 2.

For the log location on other distributions, see Kubelet logs: locations and troubleshooting.

Step 2. Add the journald receiver to the agent

The agent container does not include journalctl. The journald receiver runs the node's own journalctl in a chroot (a process that sees the mounted host filesystem as its root). The agent mounts the host filesystem at /hostfs. Foundry always adds this mount. The Helm chart adds it when host metrics collection is on (presets.hostMetrics.enabled: true, the default). If you set presets.hostMetrics.rootPath, the mount uses that path, so use it in root_path too. This setup needs two changes to the agent:

  • Collector image 0.140.0 or newer. The root_path and journalctl_path options first ship in that release. The k8s-infra chart and Foundry use 0.139.0 by default.
  • The agent runs as root, so that it can run journalctl and read the journal files.

The receiver operators turn each journal entry into a log record:

  • The kubelet writes klog lines. klog is the Kubernetes log format, and its first letter is the level: I, W, E, or F. The regex_parser operator maps this letter to the log severity.
  • The move operators put the kubelet message in the log body and the systemd unit in the systemd.unit attribute.

Add this to override-values.yaml:

override-values.yaml
otelAgent:
  image:
    tag: 0.140.0
  securityContext:
    runAsUser: 0
    runAsGroup: 0
  config:
    receivers:
      journald/kubelet:
        root_path: /hostfs
        journalctl_path: /usr/bin/journalctl
        units:
          - kubelet
        start_at: end
        operators:
          - type: regex_parser
            parse_from: body.MESSAGE
            regex: '^(?P<klog_level>[IWEF])\d{4} '
            on_error: send_quiet
            severity:
              parse_from: attributes.klog_level
              overwrite_text: true
              mapping:
                info: I
                warn: W
                error: E
                fatal: F
          - type: remove
            field: attributes.klog_level
            if: 'attributes.klog_level != nil'
          - type: move
            from: body._SYSTEMD_UNIT
            to: attributes["systemd.unit"]
          - type: move
            from: body.MESSAGE
            to: body
    service:
      pipelines:
        logs:
          receivers: [otlp, journald/kubelet]

Make these changes to the example before you apply it:

  • Keep the image block only if the agent runs a Collector release older than 0.140.0. If the agent already runs 0.140.0 or newer, remove the block, so that the upgrade does not change the image to an older release. After a later chart upgrade whose default image is 0.140.0 or newer, remove the block too. Run this to see the current image:

    kubectl get daemonset my-release-k8s-infra-otel-agent -o jsonpath='{.spec.template.spec.containers[0].image}'
  • Add journald/kubelet to the receivers list that your logs pipeline already has. Helm replaces lists, so a receiver that is missing from your list stops. The chart adds filelog/k8s to the list by itself when pod log collection is on.

Run this from the directory that contains override-values.yaml to apply the change:

helm upgrade my-release signoz/k8s-infra -f override-values.yaml

Verify these values:

  • my-release: The name of your k8s-infra Helm release.

Step 3. Make sure that the agent runs on every node

Run this on the machine where you use kubectl:

kubectl rollout status daemonset/my-release-k8s-infra-otel-agent --timeout=180s

The command prints successfully rolled out when the agent pod on every node is ready. If it times out, or a pod shows CrashLoopBackOff in kubectl get pods, go to Troubleshooting.

Validate

  1. In SigNoz, open Logs > Logs Explorer.
  2. Filter by systemd.unit = kubelet.service. For RKE2, filter by log.file.name = kubelet.log.
  3. Make sure that the log body is the kubelet message, and that severity_text shows the level, for example INFO or ERROR. Each log has the k8s.node.name of the node that wrote it. Group the results by k8s.node.name to make sure that logs arrive from every node.
Kubelet logs filtered by systemd.unit = kubelet.service in SigNoz Logs Explorer
Kubelet logs in Logs Explorer
Kubelet log details in SigNoz with severity ERROR, the systemd.unit attribute, and the k8s.node.name resource attribute
A kubelet error log with its severity and attributes

To produce kubelet errors for a test, start a pod with an image that does not exist. The kubelet logs ErrImagePull and ImagePullBackOff errors until you delete the pod:

kubectl run kubelet-test --image=doesnotexist.invalid/nope:1 --restart=Never

Delete the pod after the test with kubectl delete pod kubelet-test.

Collect kubelet logs on RKE2

RKE2 runs the kubelet with --log-file=/var/lib/rancher/rke2/agent/logs/kubelet.log, so the journal has no kubelet entries. Use the filelog receiver to read the file through the /hostfs mount that Step 2 describes. The file is readable only by root, so the agent runs as root. The default collector image works for this receiver.

Add this to override-values.yaml:

override-values.yaml
otelAgent:
  securityContext:
    runAsUser: 0
    runAsGroup: 0
  config:
    receivers:
      # On Collector v0.149.0 and newer, use "file_log" to avoid a deprecation warning.
      filelog/kubelet:
        include:
          - /hostfs/var/lib/rancher/rke2/agent/logs/kubelet.log
        start_at: end
        operators:
          - type: regex_parser
            regex: '^(?P<klog_level>[IWEF])\d{4} '
            on_error: send_quiet
            severity:
              parse_from: attributes.klog_level
              overwrite_text: true
              mapping:
                info: I
                warn: W
                error: E
                fatal: F
          - type: remove
            field: attributes.klog_level
            if: 'attributes.klog_level != nil'
    service:
      pipelines:
        logs:
          receivers: [otlp, filelog/kubelet]

Add filelog/kubelet to the receivers list that your logs pipeline already has, as in Step 2. The chart adds filelog/k8s by itself. Apply the change with helm upgrade as in Step 2.

Then make sure that the agent runs on every node, as in Step 3. Each log carries the log.file.name attribute with the value kubelet.log.

RKE2 rotates kubelet.log when it reaches 50 MB. It renames the old file to kubelet-<timestamp>.log.gz and starts a new kubelet.log. While the agent runs, the receiver follows the new file. It does not read the .gz files.

Troubleshooting

Agent crashes with invalid keys: journalctl_path, root_path

The agent runs a collector image older than 0.140.0. Older releases do not have the root_path and journalctl_path options, and the collector does not start.

Set otelAgent.image.tag to 0.140.0 or newer, as in Step 2, and apply the change.

Verify: The kubectl rollout status command from Step 3 prints successfully rolled out.

Agent pod in CrashLoopBackOff with fork/exec /usr/bin/journalctl: operation not permitted

The agent does not run as root, so it cannot run journalctl in the chroot. The agent stops with cannot start pipelines, and no data from that agent arrives: kubelet logs, pod logs, and metrics.

Add the securityContext with runAsUser: 0 and runAsGroup: 0, as in Step 2, and apply the change.

Verify: The kubectl rollout status command from Step 3 prints successfully rolled out, and kubelet logs appear in Logs Explorer.

open /hostfs/var/lib/rancher/rke2/agent/logs/kubelet.log: permission denied

On RKE2, kubelet.log is readable only by root, and the agent does not run as root. The agent logs this error every 200 ms.

Add the securityContext with runAsUser: 0 and runAsGroup: 0, as in the RKE2 section, and apply the change.

Verify: The error stops, and logs with log.file.name = kubelet.log appear in Logs Explorer.

The agent starts, but no kubelet logs arrive

The kubelet on your nodes runs under a different systemd unit name, or it does not write to the journal.

  1. On a node, run systemctl list-units --type=service | grep -i kubelet to find the unit name.
  2. If the unit has another name, put that name under units in the receiver and apply the change.
  3. If no unit exists, find the kubelet log file with the guide to kubelet log locations, and read it with a filelog receiver as in the RKE2 section.

Verify: Logs with systemd.unit set to your unit name appear in Logs Explorer.

The log body is a JSON map with MESSAGE and _SYSTEMD_UNIT fields

The receiver has no operators block. Without operators, the journald receiver sends the full journal entry as the body, and the severity is empty.

Add the operators block from Step 2 and apply the change.

Verify: New logs show the kubelet message as the body and a severity of INFO or ERROR.

Limitations

  • With global.cloud: gcp/autogke (GKE Autopilot), the k8s-infra chart does not mount the host filesystem, so neither receiver can read the node.
  • The setup needs a DaemonSet with access to the node filesystem. Nodes that do not run DaemonSets, such as Amazon EKS on AWS Fargate, cannot send kubelet logs this way.
  • The agent runs as root for both receivers. If your cluster policy blocks root containers, allow it for the agent DaemonSet.
  • With start_at: end, the agent sends only the kubelet logs that the node writes while the agent runs. Logs from before the agent starts, and from the time that the agent is down, for example during an upgrade, do not reach SigNoz.

Next steps

Get Help

If you need help with the steps in this topic, please reach out to us on SigNoz Community Slack. If you are a SigNoz Cloud user, please use in product chat support located at the bottom right corner of your SigNoz instance or contact us at cloud-support@signoz.io.

Is this page helpful

Last updated—November 26, 2026