Skip to main content
Something broke in Bob’s cluster last night, and this morning everyone wants to know what happened. Bob runs the team’s Kubernetes cluster, so the question lands on his desk. At the center of it is a small pod called app. All day and all night it writes a line every time someone does something on the website: a user logs in, someone opens a page, a login fails. Each of those lines is a tiny piece of evidence. So where does Bob go to read last night’s evidence?
A dark-themed infographic titled "Last Night's Evidence" showing a friendly app node labeled "node01" between a user icon named "Bob" and a panel of timestamped logs. The logs read: 02:14 USER1 logged in, 02:14 USER2 opened page, and 02:15 USER3 login failed.
Bob’s first move is the obvious one: ask Kubernetes for the pod’s logs.
But those lines are all from this morning. The pod that was running at 02:14 isn’t this pod anymore—Kubernetes replaced it a few hours ago. When a pod (or container) is replaced, the new one starts with an empty history and the old pod’s local logs leave with it.
Tip: kubectl logs --previous can show logs from a previous container instance, but only when the container restarted in place. It cannot recover logs from a pod that was deleted and removed from the node.
Bob’s cluster has multiple nodes and each node keeps logs on its local disk. The app writes into a folder on whichever node it lands. If the incident touched pods on multiple nodes, Bob would need to open terminals on each node, search and copy lines into a notepad, and align timestamps by hand. That might work on a quiet afternoon, but it’s hopeless at 3 a.m. with the site down. Design the solution starting from the problem:
  • Each log line should leave the node as soon as it’s written, before pods are replaced.
  • Logs need a single durable home that keeps them after pods are gone and can index millions of lines for fast lookup.
  • Bob needs a simple search-and-visualize window so he can type a username and see every related line in order.
This suggests three roles: a collector on every node, a document store that indexes logs, and a UI for searching and visualizing them. The collector is Fluentd: a lightweight agent that tails log files, normalizes them with plugins, and forwards them to a backend. The durable home is Elasticsearch: a document-oriented search engine where each log line becomes a small document (default HTTP port 9200). The UI is Kibana: a web frontend (default port 5601) that queries Elasticsearch and provides search boxes and visualizations. Take the first letters and you get the stack name: EFK.
A dark-themed diagram titled "The Window Is Kibana" showing a data pipeline: a device sends logs to Fluentd, then to Elasticsearch (port 9200), then to Kibana (port 5601). The flow ends at a user avatar labeled "Bob" alongside a small dashboard and storage icon.
Why run EFK inside Kubernetes instead of on separate VMs? Kubernetes already manages lifecycle, scaling, and recovery; and each EFK component maps cleanly to native Kubernetes primitives:
A dark-themed diagram titled "Kibana and a Service" showing three small blue robot icons sitting on server-like platforms. A labeled "Service" box above connects to the middle robot with a solid arrow and to the left robot with a dotted line.
A recommended sequence for bringing the stack up:
  1. Start Elasticsearch correctly (StatefulSet + PVs) so data survives restarts.
  2. Deploy Fluentd as a DaemonSet so logs are collected from every node as soon as they’re written.
  3. Deploy Kibana (Deployment) and point it at Elasticsearch.
  4. Once logs flow, add health checks, alerts, scaling rules, access controls, and parsing/enrichment rules.
Keep one image in mind: a log line about a user logging in is born in the app. Fluentd picks it up on the node. Elasticsearch stores it as a document. Bob finds it in Kibana minutes or months later. Every log moves that line further along its trip. But before Bob adds a single new pod, he should inventory what’s actually running in his cluster. Below that line is the next set of questions: what nodes exist, what logging agents are present, and what persistent volumes are available? Those answers determine how to bootstrap EFK safely and reliably. Links and References

Watch Video