Reference Architecture Note: This setup uses third-party components. Versions, defaults, and command syntax may change over time. Address any issues not specific to SambaStack to the vendor or project that owns that component.
Prerequisites
Before deploying Fluent Bit, ensure you have:- Kubernetes cluster — A running cluster with SambaStack installed
- OpenSearch — Deployed in the
monitoringnamespace. See Log Storage - OpenSearch - OpenSearch admin password — The password configured during OpenSearch deployment
- Helm (latest version) — For deploying the Fluent Bit chart
- kubectl — Configured with access to your target Kubernetes cluster
Resource requirements
The following are minimum resource recommendations for Fluent Bit:| Component | CPU Request | Memory Request | Storage |
|---|---|---|---|
| Fluent Bit (per node) | 100m | 128Mi | — |
Fluent Bit runs as a DaemonSet with one pod per node. Total cluster resources scale linearly with node count.
Architecture overview
In the SambaStack monitoring reference architecture:- Fluent Bit runs as a DaemonSet, ensuring one log forwarder per Kubernetes node
- Collects logs from all pods and containers via
/var/log/pods/ - Enriches logs with namespace, pod, and container metadata using a Lua filter
- Forwards logs to OpenSearch using secure TLS connections on port 9200
How Fluent Bit log collection works:
- Kubernetes automatically writes container logs to
/var/log/pods/on each node - Fluent Bit reads these logs directly from the host filesystem via a DaemonSet
- Multiple parsers are configured to support both CRI and Docker log formats
- Fluent Bit automatically selects the correct parser at runtime
- Logs are enriched with Kubernetes metadata and forwarded to OpenSearch
Deployment steps
Step 1: Add the Helm repository
Step 2: Retrieve the OpenSearch password
Get the OpenSearch admin password you created during OpenSearch deployment:Step 3: Create the Lua script
Save the following as~/.sambastack-observability/fluentbit/append_tags.lua:
Using a separate Lua file is less error-prone than embedding the code inline in the configuration file.
Step 4: Create the configuration file
Save the following as~/.sambastack-observability/fluentbit/fluentbit-conf.conf:
Configuration explanation
Configuration explanation
INPUT section: Tails log files from all pods, excluding Fluent Bit’s own logs to prevent recursion.FILTER (Lua): Runs the external
append_tags.lua script to extract namespace, pod, and container names from the log file path.FILTER (parser): Attempts to parse log content as JSON or nginx ingress format.OUTPUT: Sends logs to OpenSearch with TLS enabled. The logs-7d index name is configurable.SERVICE: Enables the HTTP server on port 2020 for health checks and metrics.Step 5: Create the configuration secret
Step 6: Create the Helm values file
Save the following as~/.sambastack-observability/fluentbit/fluentbit-values.yml:
Step 7: Install Fluent Bit
Verification
Check pod status
Verify Fluent Bit pods are running on each node:Verify logs are reaching OpenSearch
Port-forward to the OpenSearch service:logs-7d index with a non-zero docs.count confirms Fluent Bit is successfully pushing logs into OpenSearch.
To stop the port-forward process:
Query sample logs
Verify log content with a sample query:namespace, pod, and container fields populated.
Success criteria
Deployment is considered successful when:- Fluent Bit DaemonSet pods are in
Runningstate on all nodes - The
logs-7dindex appears in OpenSearch with documents - Sample log queries return entries with namespace/pod/container metadata
Configuration reference
| Section | Parameter | Description |
|---|---|---|
| INPUT | Buffer_Chunk_Size | Initial buffer size for reading log files (10MB) |
| INPUT | Buffer_Max_Size | Maximum buffer size per monitored file (64MB) |
| INPUT | Mem_Buf_Limit | Memory buffer limit before backpressure (64MB) |
| INPUT | Rotate_wait | Seconds to wait before reading rotated files (120) |
| INPUT | Exclude_Path | Glob pattern for logs to skip (Fluent Bit’s own logs) |
| OUTPUT | Index | OpenSearch index name for logs (logs-7d) |
| OUTPUT | tls | Enable TLS for OpenSearch connection |
| OUTPUT | tls.verify | Verify TLS certificate (Off for self-signed) |
| SERVICE | Flush | Interval in seconds to flush records to output (10) |
| SERVICE | HTTP_Port | Port for Fluent Bit’s HTTP server metrics (2020) |
Troubleshooting
Pods not starting (ImagePullBackOff)
Symptom: Fluent Bit pods showImagePullBackOff or ErrImagePull.
Solution: Verify your cluster can reach the container registry. Check for network policies or proxy requirements.
No logs appearing in OpenSearch
Symptom: Thelogs-7d index doesn’t exist or has zero documents.
Possible causes and solutions:
-
OpenSearch not reachable:
-
Wrong password:
Verify the password in
fluentbit-values.ymlmatches the OpenSearch admin password. -
Secret not mounted:
Logs missing metadata fields
Symptom: Logs appear in OpenSearch butnamespace, pod, or container fields are missing.
Cause: The Lua filter failed to parse the log file path.
Solution: Check that logs are coming from the expected path pattern (/var/log/pods/*/*/*.log).
High memory usage
Symptom: Fluent Bit pods are OOMKilled or show high memory consumption. Solution: Reduce buffer sizes in the configuration:Next steps
After Fluent Bit is forwarding logs:- Deploy Prometheus and Grafana — Add visualization dashboards for your logs. See Monitoring with Prometheus and Grafana.
- Explore logs in Grafana — Once Grafana is deployed with the OpenSearch datasource, you can query and visualize logs using the Explore feature.
Cleanup
To remove Fluent Bit from your cluster: Uninstall the Helm release:Removing Fluent Bit stops log forwarding but does not delete existing logs in OpenSearch. To remove historical logs, delete the index directly in OpenSearch or wait for index lifecycle policies to expire the data.
