Course contentsShow
← Cloud and Infrastructure
Lesson 2040 of 2,98943. Observability - LoggingFree lesson

Fluent Bit for Kubernetes Logging

Deploy Fluent Bit as DaemonSet for lightweight, high-performance log forwarding from Kubernetes nodes and containers.

Fluent Bit for Kubernetes Logging

What you'll learn: How to deploy Fluent Bit as a DaemonSet for efficient, lightweight log collection from every Kubernetes node and container.

Why Fluent Bit in Kubernetes?

In Kubernetes, containers scatter logs across multiple nodes. Fluent Bit, the lightweight sibling of Fluentd, runs as a DaemonSet—one pod per node—acting like a vigilant mail carrier who picks up logs from every house (container) on their route. Its tiny resource footprint (~450KB binary) makes it ideal for running on every node without draining cluster resources.

DaemonSet Deployment Pattern

When deployed as a DaemonSet, Kubernetes automatically places a Fluent Bit pod on each node, including new ones that join the cluster. These pods:

  • Tail container logs from /var/log/containers/
  • Parse log formats (JSON, Docker, CRI-O)
  • Enrich with Kubernetes metadata (pod name, namespace, labels)
  • Forward to backends like Loki, Elasticsearch, or cloud storage

Think of it as installing a smart sensor in every room of a building—each sensor knows exactly what's happening in its space and reports back centrally.

Configuration Essentials

Fluent Bit uses ConfigMaps for configuration. You define:

  • Inputs: Where logs come from (tail plugin for container logs)
  • Filters: Kubernetes metadata enrichment, parsing rules
  • Outputs: Destination (Loki, Elasticsearch, S3, etc.)

The Kubernetes filter automatically adds pod/namespace/container information to each log line, making them searchable and contextual—essential for troubleshooting in dynamic environments.

Key Takeaway: Deploying Fluent Bit as a DaemonSet ensures every Kubernetes node has a lightweight, high-performance log collector that enriches container logs with Kubernetes context before forwarding them to your centralized logging backend.