How Kubernetes pod logs, events and node logs reach Loki
A platform team usually discovers the gap the hard way: pod logs sit on individual nodes, a restarted pod takes its history with it, and the events explaining why a pod was evicted expire from the API server within a short window. Loki addresses this by collecting all three kinds of cluster logs into one store: pod logs from every container's standard output and error streams, Kubernetes events from the API server, and node logs from the operating system running each machine. The method follows Loki's Kubernetes tutorial, which uses the Kubernetes Monitoring Helm chart to deploy Grafana Alloy as the collector for each category.
Each category needs a different collection path. Pod logs are read on each node and labelled with namespace, pod, container and workload metadata. Events are not written to a file at all: Alloy's loki.source.kubernetes_events component tails the Kubernetes API and converts each event into a log line, so it needs read access to events through a service account with RBAC permissions that your cluster security policy must approve. Node logs come from the host journal or system logs, which requires the collector to mount host paths. Before you install the chart, decide which namespaces, node pools and host paths are in scope, and confirm with your security team that a privileged or host-mounting collector is acceptable under your Pod Security Standards settings for the monitoring namespace.
The Helm values you set decide what Loki receives and how much it costs to query. Confirm the Loki endpoint, the X-Scope-OrgID tenant that the cluster writes to, and whether events and node logs go to the same tenant as pod logs. Then test each category separately: create a deliberately failing pod, check that its output and the matching event both appear in Loki, and confirm that a node log query returns entries for every node. Silent gaps are more common than errors here, because a missing RBAC rule or host mount usually produces no visible failure. The label choices that keep these streams manageable are covered in the labels and cardinality section.
What a Kubernetes-to-Loki collection setup needs before installation
Four things must be in place before the Kubernetes Monitoring Helm chart and Alloy can ship anything: a supported cluster, a reachable Loki endpoint with tenancy decided, network paths and a Helm install identity, and a Grafana instance to query the result. Each card names one of these and the check to run before work starts.
Supported Kubernetes minor version
Confirm your cluster's minor version against the supported releases page before choosing chart and Alloy versions. Kubernetes maintains only the three most recent minor releases, and each one has a fixed end-of-life date, so a cluster on an unsupported minor will receive no upstream fixes. Check the version skew policy too, since kubelets on nodes may lag the API server by a limited number of minors. Record the exact server version, not only the client version.
- Supported minor releases
- 3
Running Loki with auth enabled
The collector must send to a Loki endpoint with auth_enabled set to true, because every push carries an X-Scope-OrgID tenant header. Decide the tenant ID for cluster logs before install, and whether events and node logs share it with pod logs. Confirm the Loki version against the releases page and the deployment mode you run. Loki has no built-in authentication, so the endpoint must sit behind an authenticating reverse proxy that also injects or validates the tenant header.
Network path from cluster to Loki
Pods in the cluster must reach the Loki write path (or the gateway in front of it) on the port and TLS settings your proxy exposes. Check egress policies, NetworkPolicy rules, proxies and firewall rules between node networks and the Loki host or load balancer. Also confirm that the Loki service can receive traffic from every node, since the DaemonSet pods push directly. A missing path usually shows up as retries in Alloy, not as an install error, so test with a short-lived pod before installing.
Helm and cluster-admin install access
The Kubernetes Monitoring Helm chart creates namespaces, service accounts, cluster roles, DaemonSets and ConfigMaps, and collecting events requires read access to the API server. Someone with cluster-admin or an equivalent scoped role must run the install, and the team should decide who owns later upgrades. Store the Loki credentials for the proxy in a Kubernetes Secret or external secrets store rather than in values files committed to Git, because Secrets are stored unencrypted in etcd by default unless encryption at rest is configured.
Secrets good practicesGrafana connected to Loki
Grafana is the query surface for the pod logs, events and node logs once they land. Confirm that the Grafana instance can reach the same authenticated Loki endpoint and send the same tenant header for the tenant you chose. Without this check, ingestion can look healthy while every query returns empty results. Plan a test query that filters on the cluster label and a known namespace before declaring the setup complete.
Configuring the Kubernetes Monitoring Helm chart and Alloy step by step
This sequence turns a Kubernetes cluster into a source of three verified log streams in self-hosted Loki: pod logs, API server events and node logs, each confirmed with a query before the next is enabled.
Confirm the Loki push endpoint and tenant
Before editing any values, the platform team confirms the URL of the Loki push endpoint reachable from the cluster, the TLS trust chain, and the tenant ID that Alloy will send in the X-Scope-OrgID header. If multi-tenancy is enabled on the Loki side (auth_enabled set to true), every request must carry that header, and a missing or wrong tenant value causes writes to fail or land in the wrong place. Because Loki has no built-in authentication layer, confirm that the endpoint sits behind the authenticating reverse proxy your organization runs, and that Alloy has a credential for it. Done when a test push with curl from a pod in the target namespace returns a success response and the tenant can be queried.
Define Helm values for the chart
Create a values file for the Kubernetes Monitoring Helm chart that names the cluster, sets the Loki destination URL and the tenant header, and disables every log category at first so each one can be enabled and checked separately. Keep this file in version control so changes are reviewed like any other infrastructure code. Pin the chart version you tested rather than tracking the latest release, and record the Alloy version it deploys. Done when the chart renders with helm template against the values file without errors, and the rendered destination matches the Loki endpoint confirmed in the previous step.
Enable and verify pod log collection
Turn on pod log collection in the values file and deploy the chart to a non-production cluster first. Alloy runs as a DaemonSet on each node and tails container logs, attaching labels such as namespace, pod and container. Verify by querying Loki in Grafana Explore with a selector on one known namespace, for example {namespace="your-test-namespace"}, after generating a line of output from a test pod. Check that the labels are the ones you expected and that no unexpected high-cardinality label, such as a request ID, has been promoted to a stream label. Done when recent lines from the test pod appear in the query result.
Enable the Kubernetes events source
Enable the events collection in the chart, which configures Alloy's loki.source.kubernetes_events component to tail events from the Kubernetes API and convert them into log lines. Confirm that the Alloy service account has RBAC permission to read events cluster-wide or in the namespaces you intend to cover, since missing permissions prevent collection. Verify with a test: create a short-lived pod in a test namespace, then query Loki for event lines from that namespace, such as a Scheduled or Pulled event, and confirm the event reason appears in the log body. Done when the test events are returned and the cluster's events are visible as a separate stream from pod logs.
Enable node log collection
Enable node log collection and review which host paths or journal sources the chart mounts, because node logs depend on read access to the host, and the scope of that access is a security decision for your team. Check the node-level labels the chart attaches so you can separate node logs from container logs in queries. Verify on one node first by querying for a node-level job or label value and confirming that system service messages from that host are present. If a source returns nothing, check Alloy's logs and mounts before assuming the cluster is quiet. Done when node log lines from a chosen host are queryable in Loki.
Deploy to production and verify each category
Roll the tested values to the production cluster with the same chart version and values file, then repeat the three checks against production data: a pod log query scoped to one namespace, an event query scoped to recent Kubernetes events, and a node log query for one host. Record the query and its result as evidence of the working configuration. Review ingestion errors in Alloy's logs and in Loki's ingestion metrics for rejected streams or label limit errors during the first hours of traffic. Done when all three categories return data from production, and no sustained write errors appear in Alloy or Loki.
How Alloy tails pods, converts events and reads node logs
Alloy runs inside the cluster and handles three separate jobs: it reads container log files from each node, it tails Kubernetes events through the API server, and it writes everything to Loki. Pod logs come from files on the node that the kubelet manages, so the collector needs to be scheduled on every node that runs workloads you want to keep, usually as a DaemonSet. Events take a different route. The events source does not read node files at all. The loki.source.kubernetes_events component calls the Kubernetes API, watches the event stream, and converts each event into a log line before forwarding it. That means the events path is only as complete as the permissions behind it.
The events source depends on API access and RBAC. The service account Alloy uses needs read permission on events across the namespaces you intend to collect, and nothing beyond that. Decide first whether you want cluster-wide events or a namespace allowlist, because the ClusterRole and binding you write set the blast radius. Confirm the exact verbs and resources against the component reference before you deploy, and test with a deliberately failing pod to confirm events appear in Loki. A missing permission usually shows up as silence in your queries, not as an obvious error, so check the Alloy logs and the component's status page as part of verification.
Node logs need host-level access, which is the part to review most carefully. Reading journal or system log files typically means mounting host paths, running with elevated privileges, or both. Those settings must be checked against your pod security policy and the Pod Security Standards that apply to the namespace where Alloy runs. Agree the mounts, capabilities and host namespaces in writing with your security team before the chart is installed, and record which node paths are exposed. Confirm with your platform team whether the cluster's admission controls allow the DaemonSet as configured.
Data flow from cluster sources to Loki and Grafana
The flow starts with pod logs and node logs read on each node by Alloy, which runs as a DaemonSet, while Alloy's Kubernetes events component tails events from the Kubernetes API server. Both streams pass through an authenticating proxy that you run in front of Loki, which forwards requests carrying the X-Scope-OrgID tenant header. Loki writes compressed chunks and its index to object storage, and Grafana queries Loki through the same proxy. Check at each boundary that the proxy enforces authentication and that the tenant header is set where you expect it.
Log and event paths from cluster sources to Loki and Grafana, with trust boundaries marked.
Which Kubernetes fields become Loki labels, structured metadata and log lines
This table sorts the fields Kubernetes attaches to pod logs, events and node logs into three destinations: stream labels, structured metadata and the log line itself. Use it to decide what to index and what to keep queryable without multiplying streams. Confirm the exact label names your Kubernetes Monitoring Helm chart version emits before writing any relabeling rules.
| Field | Suggested destination | Why it belongs there | Watch for |
|---|---|---|---|
| Namespace | Stream label | Bounded set per cluster, and the most common filter for on-call engineers | Confirm the label name the chart version emits |
| Pod name | Stream label, reviewed | Useful for tracing one workload, but changes on every rollout and multiplies streams | Prefer workload or app labels where the chart offers them |
| Container | Stream label | Small, stable set per pod, and separates sidecar output from application output | Init containers can create extra streams during startup |
| Node | Stream label, reviewed | Helps isolate node-level faults, but node count grows with cluster size | Check how many nodes churn through autoscaling |
| Job and event type | Stream label | Few distinct values, separates pod logs, API server events and node logs cleanly | Keep event types to a short fixed list |
| Pod UID, container ID, request IDs | Structured metadata or log line | Unique per pod or request, so indexing them creates a new stream for each value | Structured metadata keeps them queryable without adding streams |
| Event message and reason text | Log line | Free text varies on every occurrence and should be parsed at query time | Parse with LogQL rather than indexing the text |
Choosing labels that keep Kubernetes streams manageable
Loki indexes only labels, so every label value you choose sets how many streams it creates and how much work ingestion and queries carry. The cards below cover the decisions that keep those counts under control, from the labels you set at collection time to the stream counts you check after rollout.
Limit labels to cluster identifiers
Keep stream labels to a small set of low-cardinality cluster identifiers such as cluster, namespace, container and a coarse app or component label. Each distinct combination of label values becomes a separate stream that Loki must index and track, so every extra label multiplies the stream count. Ask your team to write the full label list in a single document before the first Alloy configuration is deployed.
Avoid pod names and UIDs
Pod names and UIDs change whenever a pod is recreated, so using them as labels creates a new stream for every replacement pod. Deployments with frequent rollouts, autoscaling or short-lived jobs can produce large numbers of short-lived streams. Use the workload or controller name as the identifying label, and check whether the Kubernetes Monitoring Helm chart defaults on your version set pod-level labels before you accept them.
Put per-request fields in structured metadata
Fields such as request IDs, trace IDs, user IDs and client addresses vary on every line, so they belong in structured metadata rather than in labels. Structured metadata is stored with the log line and can be filtered in LogQL without creating streams. Confirm with your Loki version that the fields you need are extracted at ingestion, and that the parser in your pipeline keeps them.
Review drop and keep rules for noisy namespaces
A single chatty namespace, such as a debug-heavy batch workload or a controller that logs every reconcile, can dominate ingestion volume and push out useful logs. Set drop or keep rules in Alloy for namespaces and containers you know are noisy, and record each rule with an owner and a reason. Review those rules on a fixed schedule, because a rule that hid a noisy source last quarter can hide a real incident today.
Check stream counts after rollout
Cardinality problems usually appear after rollout, when real workloads add label values that test clusters never produced. Measure the number of active streams and ingestion volume per tenant in the first days of production, and compare them with your baseline from staging. Confirm with your Loki monitoring setup that you can see stream counts and rejected writes, and set an alert so a sudden jump is caught before queries slow down.
Kubernetes Monitoring docsCommon failures when collecting Kubernetes logs into Loki
This table lists the failures teams most often hit when collecting pod logs, API server events and node logs into Loki, with the likely cause and the first fix for each. Read it as a triage list: match the symptom you see to a row, then confirm the cause in your own cluster before changing configuration.
| Symptom | Likely cause | First fix |
|---|---|---|
| No Kubernetes events appear in Loki | The Alloy service account lacks RBAC permission to read events from the API server | Grant get, list and watch on events to the collector's service account, then check the component output |
| Node logs are empty | Host paths or the log directory are not mounted, or the collector pod lacks permission to read them | Confirm the host log path is mounted read-only into the collector and that its security context allows the read |
| 401 or missing tenant errors | auth_enabled is true but the sender does not send X-Scope-OrgID, or the header value does not match the tenant | Align the tenant ID in the collector and the query path, and set the header on every write |
| Thousands of streams from pod names | Pod name or container ID used as a label, so every new pod creates a new stream | Keep labels to namespace, app and container; move pod detail to structured metadata |
| Duplicate log lines after a restart | The collector re-read files from the start because its read position was not persisted | Persist the collector's positions file on a volume that survives restarts |
| Logs stop after a Helm upgrade | Values changed the release name, namespace, tenant or endpoint, so the new pods write somewhere else | Diff the rendered values against the previous release and confirm the Loki write URL and tenant |
| Log volume spikes after enabling collection | Verbose debug output from applications or a broad namespace selector | Narrow the namespace selection and drop or sample noisy streams at the collector |
How to verify each log category end to end
Write the acceptance criteria for all three log categories before you install anything, so the pass or fail decision is not made after the fact. For each category, record the exact input you will create, the Loki query that should return it, the labels you expect on the result, and the time window within which it must appear. Pod logs, Kubernetes events and node logs each need their own row, because a pipeline can work for one category and silently drop another. Agree the criteria with whoever owns the Loki tenant and the Grafana dashboards, since they will be the ones querying the data later.
For pod logs, deploy a test pod in a disposable namespace that writes a known, unique string at a fixed interval, then confirm in Grafana Explore that the string arrives with the namespace, pod and container labels you planned. Check that the X-Scope-OrgID value your Alloy pipeline sends matches the tenant the query runs against, because a mismatch returns empty results rather than an error. For Kubernetes events, deploy a workload that references an image that does not exist in a disposable namespace, so the kubelet records a failed image pull. Confirm that the event appears in Loki through loki.source.kubernetes_events with the event reason and involved object visible, and that it does not appear under the pod log labels. Delete the namespace afterward.
For node logs, write a unique marker line to the journal on a test worker node, confirm it arrives with the host and unit labels you chose, and then restart that node in a maintenance window. After the node is back, rerun the pod log check and compare the marker lines written before and after the restart. Expect gaps only for the period the node was down, and treat any loss of lines written while the node was running as a failure to investigate. Confirm the exact behavior of your chosen collector on restart with your own environment before you accept it, and repeat the full test after each Alloy or Helm chart upgrade.
Questions teams ask before collecting Kubernetes logs into Loki
What drives the cost and effort of collecting Kubernetes logs into Loki?
The main driver is how many clusters, namespaces and workloads you need to cover, and how much of the Loki side is already built. Effort splits into three parts: the Loki backend (object storage, retention, tenancy and Grafana access), the collection layer (Alloy deployed through the Kubernetes Monitoring Helm chart), and the label design that keeps streams manageable. Cost recurs in cloud or data center capacity for storage and compute, and one-time in design and build. When you request a quote, ask the provider to list each cluster in scope, the Loki deployment mode, the object store, the retention rules per tenant, and who operates the result after handover.
How long does a typical Kubernetes log collection setup take?
Duration depends less on the collector than on the readiness of your clusters and your Loki environment. If a Loki cluster already runs with object storage and Grafana access, the collection work is mostly configuration and verification. If Loki, the object store or identity integration still need building, that work sets the schedule. Ask any provider for a timeline built from a written scope, and check that it accounts for cluster access approvals, change windows and testing across each cluster. This page does not give a duration because it varies with those factors.
What does the work need from our team?
Expect to supply people who know the clusters and the platform rules. Your platform or cluster team needs to confirm Kubernetes versions, namespaces to include, node access and RBAC permissions for the collector, and where Helm releases are approved. Your Loki or observability owner needs to confirm tenant IDs, retention requirements and the Grafana data source model. Your security team should review what appears in logs, since pod logs can carry sensitive values, and confirm how the Kubernetes API read permissions for events are granted. Agree on these owners before the build starts.
Can our team set this up alone using the official tutorial?
Often yes, if you have engineers who already operate Kubernetes and Helm and can test in a non-production cluster first. Loki's Kubernetes tutorial covers the three categories of cluster logs (pod logs, Kubernetes events from the API server and node logs) using the Kubernetes Monitoring Helm chart. The harder parts tend to be the decisions the tutorial cannot make for you: label choices that avoid high cardinality, tenant separation, retention policy, and how Loki is exposed behind an authenticating reverse proxy, since Loki has no built-in authentication layer. If no one on your team has run Loki in production, an outside review of those decisions is a reasonable middle option.
What changes if we run Promtail today?
Promtail reached end of life on March 2, 2026, with no further updates or commercial support, and Grafana directs Promtail users to migrate to Grafana Alloy. For Kubernetes, that means the collection layer moves to Alloy, typically deployed through the Kubernetes Monitoring Helm chart, and existing Promtail label and pipeline configuration must be re-expressed in Alloy components. Plan the cutover so logs are not lost during the switch, compare label sets between old and new streams, and confirm dashboards and alerts still match. The migration is a distinct piece of work; see the migration content for the documented path.
Which Kubernetes event logs does Alloy collect, and what should we check?
Alloy's loki.source.kubernetes_events component tails events from the Kubernetes API and converts them into log lines, so cluster events such as scheduling and pod lifecycle messages become searchable in Loki. Check that the collector's service account has only the read access it needs, because Kubernetes Secrets and API data are sensitive. Also confirm that event volume does not create excessive streams, since events can be noisy during rollouts. Review the component reference before enabling it in production.
Which label choices keep Kubernetes logs in Loki affordable?
Use a small, stable set of labels such as cluster, namespace, and workload or app name, and keep fields with unbounded values, such as pod name, request IDs or container IDs, out of stream labels. Each unique label combination creates a stream, so high-cardinality labels increase index size and query cost. Decide the label set before collection starts, because changing labels later creates new streams and breaks existing queries. Ask any implementation partner to show the label schema and a test showing stream counts per cluster.
Official documentation for this integration
Start with the Loki Kubernetes Monitoring Helm tutorial, which covers the three categories of cluster logs this page is about: pod logs, Kubernetes events from the API server and node logs. Read it alongside your chart values file so you can map each category to the collector configuration you plan to run. Confirm the chart version you intend to install against the current release notes before you copy any values, because chart keys change between releases and the tutorial reflects the version it was written for. The tutorial is the right reference for how the chart wires Alloy to Loki, while your own environment decides which namespaces, node pools and label keys you keep.
Next, read the Alloy reference for loki.source.kubernetes_events. The component tails events from the Kubernetes API and turns them into log lines, so you need to check which event fields become labels, how the component handles restarts and where it reads its credentials. Pay attention to the RBAC the collector service account needs to list and watch events, and grant only that access. Plan a test in a non-production cluster that generates a known event, such as a deliberately failing pod, and confirm the line appears in Loki with the labels you expect before you rely on it for alerting.
Then read the Kubernetes authentication documentation and the good practices page for Secrets. The authentication page explains how user and service identities reach the API server, which determines who can read the cluster events and node logs you are collecting. The Secrets page matters because your collector configuration, Loki credentials and any object storage keys will often live in Kubernetes Secrets, which are stored unencrypted in etcd by default unless you configure encryption at rest. Confirm that encryption at rest is enabled on your clusters and that access to those Secrets is limited by RBAC before you store Loki write credentials in them.
How DeployOpen scopes and delivers Kubernetes log collection into Loki
DeployOpen plans and delivers Kubernetes pod log, event and node log collection into self-hosted Loki inside your own clusters and cloud accounts. The work starts with a written scope that fixes labels, tenants and retention before any collector is deployed.
How we scope
- Inventory the clusters, namespaces and node pools whose pod logs, API events and node logs must reach Loki
- Agree the label set, tenant mapping and structured metadata rules in writing before collection starts
- Confirm the Loki deployment mode, object store, retention periods and the Kubernetes versions in use
How we build
- Deploy the Kubernetes Monitoring Helm chart and Grafana Alloy configuration into your non-production cluster first
- Verify pod log, event and node log streams with test workloads, checking label cardinality against agreed limits
- Test the authenticating reverse proxy, tenant headers and Grafana data source access before promoting to production
How we hand over
- Deliver Helm values, Alloy configuration and the label catalogue as versioned files in your repository
- Document the collection pipeline, retention settings and runbooks for dropped or throttled log streams
- Walk your platform and security teams through the configuration and the verification results before handover
How we support
- Support ongoing upgrades of the Helm chart, Alloy and Loki alongside your Kubernetes upgrade schedule
- Offer retainers for continuous monitoring of ingestion health, label growth and collector configuration
- Revisit the scope when namespaces, clusters or compliance log retention requirements change

