Skip to main content
Bob doesn’t take the war story on faith — he wants to verify it himself. He execs into a pod that has nothing to do with logging: a small NGINX webserver called webserver running in the default namespace. From inside that pod he calls Elasticsearch at its cluster-internal address. The response returns the Elasticsearch data immediately — including every user that had been searched for. No one asked who he was, and there was no password challenge. Kibana was no better. When Bob first opened it, there was no login screen; later it still exposed activity without authentication:
And that is only the first hole. What happens to a log line on its way from Fluentd to Elasticsearch? Bob inspects the Fluentd output configuration and finds it using plain HTTP, certificate verification disabled, and an empty user field:
Because the connection uses plain HTTP (scheme http) there is no TLS encryption; setting ssl_verify false only affects TLS certificate verification, so with plain HTTP every line travels as readable text on the network. Anyone sniffing the traffic can see things like “user five failed to log in” exactly as the app wrote it. Logs may seem dull, but they collect usernames and sometimes sensitive data that should never be logged. So Bob faces two primary threats:
  • Anyone can request logs (unauthenticated access).
  • Anyone on the wire can read logs (unencrypted transport).
An infographic titled "Two Open Doors" with two panels: the left shows a friendly chatbot and an Elasticsearch-like logo with a label "USER1 logged in" under the caption "Anyone can ask." The right panel shows an eye icon and a dotted connection from a user to the same logo labeled "USER5" under the caption "Anyone can read."

Closing the doors: a layered approach

The secure, practical way to protect logs is to apply several layers of controls. Each control addresses a different threat (authentication, network isolation, encryption, and secret access). Below are the steps Bob implements and why each one matters.

1) Enforce authentication and authorization (Elasticsearch & Kibana)

First: stop unauthenticated requests. Elasticsearch ships security features (historically X-Pack Security) to require authentication and to enforce authorization rules. When security is enabled, every request must present valid credentials.
  • Create an Elasticsearch user for the logging pipeline (Fluentd) and a separate user for Kibana.
  • Configure Kibana to use its own credentials so users who open the UI must log in.
Where should these passwords live? Do not hard-code secrets in manifests or plain files in a repository. Use Kubernetes Secrets to store small sensitive values (passwords, certificates) and mount or expose them only to the ServiceAccount that needs them.
A dark-themed graphic of a Kibana login screen titled "Kibana Needs Its Own Key," showing username and password fields with a "Log in" button. To the left is a blue cartoon mascot and a small green key.
Never store production passwords or private keys in plaintext manifests or public repositories. Use Kubernetes Secrets and grant access only to the specific ServiceAccount that requires the secret.
The image shows the caption "A Secret Holds the Value" with a small blue character on the left. On the right is a locked box labeled "Secret" containing a key and an ID-style card icon.
Practical references:

2) Restrict network access with NetworkPolicy

Second: stop unrelated pods from reaching Elasticsearch. The webserver pod lives in the default namespace and has no business talking to the Elastic Stack. Kubernetes NetworkPolicy acts as a guest list for pod-to-pod traffic: select the pods you want to protect and declare who may connect to them and where they may connect. Example policy intent for the elastic-stack namespace:
  • Allow ingress to Elasticsearch and Kibana only from pods in elastic-stack.
  • Allow egress from components in elastic-stack only to pods in elastic-stack.
When webserver from default tries to connect, the requests stall and time out because the policy blocks the traffic.
A dark-themed diagram titled "An Envelope for Every Line" showing two grouped areas: a "default" box with a web-server icon and an "elastic-stack" box containing three smiling service icons labeled elasticsearch-0, fluentd, and kibana. Between them is a small clipboard marked "In/Out" and a padlock symbol, with the heading "Plugin Must Enforce" visible below.
NetworkPolicy rules are effective only if your cluster’s CNI/network plugin implements and enforces them. Confirm your CNI supports NetworkPolicy (for example, Calico, Cilium, or kube-router) before relying on them.
Helpful links:

3) Encrypt the transport (TLS and optional mTLS)

Third: stop eavesdroppers on the wire. Encrypt log transport using TLS so messages are unreadable to anyone intercepting packets. Configure Fluentd to use HTTPS to talk to Elasticsearch, and have Fluentd verify Elasticsearch’s certificate. For stronger guarantees, use mutual TLS (mTLS): Fluentd also presents a certificate so Elasticsearch can authenticate the sender. mTLS requires an operational process for issuing and rotating certificates (PKI), which is an operational topic beyond this article.
An infographic titled "Both Sides Show a Card" illustrating Mutual TLS. It shows two blue service mascots labeled "fluentd" and "elasticsearch-0" connected by a line with a padlock, keys, and a certificate icon.
Guidance:
  • Configure Fluentd’s Elasticsearch plugin to use scheme https, set ssl_verify true, and reference CA certs mounted from a Secret.
  • Consider mTLS if you need to guarantee the client identity (Fluentd) to Elasticsearch.

4) Limit who can read Secrets (RBAC)

Finally: control who can read Secrets. Anyone with permission to read Secrets through the Kubernetes API can access credentials. Use Role-Based Access Control (RBAC) to grant least privilege:
  • Create a Role that allows get/watch/list only for the specific Secret(s) used by Fluentd.
  • Bind that Role to Fluentd’s ServiceAccount only.
Putting it all together, Bob has a lock for every door: a password at the service counter, a guest list at the cluster gate, end-to-end encryption on the wire, and strict RBAC limiting who can read the keys.
A dark-themed slide titled "A Lock for Every Door" showing four circular icons labeled Password, NetworkPolicy, TLS, and RBAC, each marked with a small padlock. The icons depict a key, a clipboard (In/Out), an envelope, and a folder respectively.

Quick reference: problems → controls → validation

Next steps: deployment, validation, and auditing

Which lock should he fit first? In many environments, the recommended sequence is:
  1. Enable authentication for Elasticsearch and Kibana (prevents immediate data exposure).
  2. Put Secrets in Kubernetes Secrets and configure RBAC (protect credentials).
  3. Implement NetworkPolicy (limit which pods can reach the stack).
  4. Enable TLS/mTLS for Fluentd→Elasticsearch (protect the wire).
  5. Instrument and audit: add monitoring, periodic validation scripts, and rotation for secrets and certificates.
These are operational choices that depend on your environment and risk tolerance; they also lead into CI/CD deployment strategies and auditing practices.

Watch Video