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:
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).

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.

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.

- Kubernetes Secrets: https://kubernetes.io/docs/concepts/configuration/secret/
- Elasticsearch security and users: https://www.elastic.co/guide/en/elasticsearch/reference/current/security-settings.html
2) Restrict network access with NetworkPolicy
Second: stop unrelated pods from reaching Elasticsearch. Thewebserver 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-stackonly to pods inelastic-stack.
webserver from default tries to connect, the requests stall and time out because the policy blocks the traffic.

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.
- Kubernetes NetworkPolicy: https://kubernetes.io/docs/concepts/services-networking/network-policies/
- Example CNIs: Calico, Cilium, kube-router
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.
- Configure Fluentd’s Elasticsearch plugin to use
scheme https, setssl_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/listonly for the specific Secret(s) used by Fluentd. - Bind that Role to Fluentd’s ServiceAccount only.

Quick reference: problems → controls → validation
Next steps: deployment, validation, and auditing
Which lock should he fit first? In many environments, the recommended sequence is:- Enable authentication for Elasticsearch and Kibana (prevents immediate data exposure).
- Put Secrets in Kubernetes Secrets and configure RBAC (protect credentials).
- Implement NetworkPolicy (limit which pods can reach the stack).
- Enable TLS/mTLS for Fluentd→Elasticsearch (protect the wire).
- Instrument and audit: add monitoring, periodic validation scripts, and rotation for secrets and certificates.
Links and references
- Kubernetes Secrets: https://kubernetes.io/docs/concepts/configuration/secret/
- Kubernetes NetworkPolicy: https://kubernetes.io/docs/concepts/services-networking/network-policies/
- Elasticsearch security: https://www.elastic.co/guide/en/elasticsearch/reference/current/security-settings.html
- Fluentd Elasticsearch plugin: https://github.com/uken/fluent-plugin-elasticsearch
- Calico: https://projectcalico.org/
- Cilium: https://cilium.io/
- kube-router: https://github.com/cloudnativelabs/kube-router