Skip to main content
Which lock goes on first? Elasticsearch — because it’s the vault everything else talks to. And how does Bob prove each lock took hold? He verifies it by reading something back from the cluster after every change — the actual answer, not a feeling that a file looked right.

Verify the cluster identity

A quick check against the Elasticsearch HTTP endpoint returns its identity:
This confirms the running node and cluster name before any security changes.

Enable security and node-to-node TLS

Bob edits the Elasticsearch StatefulSet to enable X-Pack security and transport TLS. In production you would normally provide these via elasticsearch.yml or mapped environment variables, and you must supply certificates/keys for transport TLS. Update the Elasticsearch container environment with these values:
Apply the updated StatefulSet; Kubernetes will replace the pod with one using the new settings:
After the change, unauthenticated requests are rejected — the cluster now requires credentials.

Create a user and verify authentication

There isn’t a user yet, so Bob creates one using the bundled elasticsearch-users tool inside the Elasticsearch pod:
Now a curl with credentials returns the cluster identity; without credentials, Elasticsearch rejects the request:

Update Kibana to authenticate to Elasticsearch

Kibana becomes unable to connect because it is another client and needs credentials configured.
A dark error screen saying "Kibana Can't Connect" with two blue mascot icons labeled "elasticsearch-0" and "kibana" and a locked padlock between them. The image indicates Kibana is unable to connect to Elasticsearch.
Bob updates the Kibana Deployment to pass the Elasticsearch username and password as environment variables:
He applies the change, waits for Kibana to restart, and a login screen appears:
A stylized Kibana login screen showing "Welcome to Kibana" with username and password input fields and a "Log in" button. A small blue mascot is on the left and the title "Kibana Gets the Password" appears at the top.
Bob signs in as elastic_user. From the terminal he can also verify Kibana’s status API with the same credentials:
The example shows the password directly in YAML so you can follow the flow. In production, store credentials in a Kubernetes Secret and reference them from manifests instead of embedding plaintext values.

Authentication is not network isolation

Elasticsearch is locked — but is it safe? Bob tests access from the wrong place. From a web server pod in the default namespace he calls the in-cluster Elasticsearch service with the username and password, and Elasticsearch answers:
A password only proves you know the password. It doesn’t prevent any pod that has no business being there from reaching the service if the network allows it. Use a NetworkPolicy to restrict which pods/namespaces can talk to the Elastic stack. Bob creates a NetworkPolicy named efk-stack-policy in the elastic-stack namespace. It restricts both ingress and egress to peers within the same labeled namespace:
Apply the policy:
When Bob repeats the exact same curl from the web server pod, the request now times out — the NetworkPolicy blocks traffic from the default namespace to elastic-stack.
A stylized network diagram titled "It Never Reached Elasticsearch" showing a web-server in a "default" namespace and an "elastic-stack" namespace with icons for elasticsearch-0, fluentd, and kibana. A lock/blocked symbol between them indicates the web-server's traffic did not reach the Elastic stack.

Update Fluentd to authenticate and enable TLS verification

Now there’s a casualty: Fluentd, sitting between the app and Elasticsearch, is suddenly stuck. Its logs show the output failures:
Elasticsearch now requires a password, and Fluentd didn’t have one configured, so it can’t send logs. Bob updates the Fluentd Elasticsearch output plugin configuration (<match> section) to enable SSL verification and provide the Elasticsearch user and password. Example Fluentd output configuration:
After editing the Fluentd config, he forces the DaemonSet to recreate its pods:
When the new Fluentd pod starts, the logs show batches being pushed and Kibana begins to fill with data again. He double-checks the config to confirm certificate verification is enabled:
Bob searches for USER1 in Kibana and the log line appears — with a timestamp and the message. This confirms logs are preserved and readable; Fluentd also creates a new index each day and none have been deleted.
A dark-themed UI screen titled "Safe, but Bare" showing a vertical list of dated file entries (e.g., fluentd-2026.10.13 to fluentd-2026.10.08). Below the list is a bold status reading "None Deleted."
Which pod wrote the line? Which environment produced it? The client log entry contains that context, and proper indexing and mappings let you query and filter by those fields — ensuring logs are both secure in transit and useful for troubleshooting and audit.

Quick reference: primary steps and checks

Watch Video

Practice Lab