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-pagerIf 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.0or newer. Theroot_pathandjournalctl_pathoptions first ship in that release. The k8s-infra chart and Foundry use0.139.0by default. - The agent runs as root, so that it can run
journalctland 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, orF. Theregex_parseroperator maps this letter to the log severity. - The
moveoperators put the kubelet message in the log body and the systemd unit in thesystemd.unitattribute.
Add this to 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
imageblock only if the agent runs a Collector release older than0.140.0. If the agent already runs0.140.0or 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 is0.140.0or 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/kubeletto thereceiverslist that your logs pipeline already has. Helm replaces lists, so a receiver that is missing from your list stops. The chart addsfilelog/k8sto 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.yamlVerify these values:
my-release: The name of your k8s-infra Helm release.
In casting.yaml, add this to the agent's document. The patches block goes under spec, next to deployment. Put the receiver in the existing agent configuration:
spec:
patches:
- target: "collectionagent/collector/agent/values.yaml"
operations:
- op: replace
path: /otelAgent/image/tag
value: "0.140.0"
- op: add
path: /otelAgent/securityContext
value:
runAsUser: 0
runAsGroup: 0
collector:
spec:
config:
data:
collector/agent/agent.yaml: |
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/http, otlp/grpc, filelog/k8s, journald/kubelet]Make these changes to the example before you apply it:
-
Keep the
replaceoperation for/otelAgent/image/tagonly if the agent runs a Collector release older than0.140.0. If the agent already runs0.140.0or newer, remove the operation, so that the cast does not change the image to an older release. After a later Foundry upgrade whose default image is0.140.0or newer, remove the operation too. Run this to see the current image:kubectl get daemonset signoz-collector-agent -n signoz -o jsonpath='{.spec.template.spec.containers[0].image}' -
Add
journald/kubeletto thereceiverslist that your logs pipeline already has. Foundry replaces lists, so a receiver that is missing from your list stops. The list in the example is the list of a default casting.
Run this from the directory that contains casting.yaml to apply the change:
foundryctl cast -f casting.yamlStep 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=180skubectl rollout status daemonset/signoz-collector-agent -n signoz --timeout=180sThe 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
- In SigNoz, open Logs > Logs Explorer.
- Filter by
systemd.unit = kubelet.service. For RKE2, filter bylog.file.name = kubelet.log. - Make sure that the log body is the kubelet message, and that
severity_textshows the level, for exampleINFOorERROR. Each log has thek8s.node.nameof the node that wrote it. Group the results byk8s.node.nameto make sure that logs arrive from every node.


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=NeverDelete 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:
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.
In casting.yaml, add this to the agent's document. The patches block goes under spec, next to deployment. Put the receiver in the existing agent configuration:
spec:
patches:
- target: "collectionagent/collector/agent/values.yaml"
operations:
- op: add
path: /otelAgent/securityContext
value:
runAsUser: 0
runAsGroup: 0
collector:
spec:
config:
data:
collector/agent/agent.yaml: |
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/http, otlp/grpc, filelog/k8s, filelog/kubelet]Add filelog/kubelet to the receivers list that your logs pipeline already has, as in Step 2. Apply the change with foundryctl cast -f casting.yaml.
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.
- On a node, run
systemctl list-units --type=service | grep -i kubeletto find the unit name. - If the unit has another name, put that name under
unitsin the receiver and apply the change. - If no unit exists, find the kubelet log file with the guide to kubelet log locations, and read it with a
filelogreceiver 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
- Collect Kubernetes pod logs to read container logs next to the kubelet logs.
- Configure the K8s Infra agent for other receivers and presets.
- Collect systemd logs for all
journaldreceiver options, such as filters by priority. - Create log-based alerts to get notified when the kubelet logs
ERRORlines.
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.