The Simplest Way to Make Elasticsearch and Kustomize Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use elasticsearch and kustomize to deploy and update search clusters across Kubernetes. Kustomize patches base YAML manifests while Elasticsearch stores and indexes your app data. This workflow lets engineers manage dev, staging, and prod clusters without copying files. You keep one base setup and apply small patches for each stage. How elasticsearch and kustomize handle permissions and data flow Kustomize reads your base files and merges stage overlays before applying them. The Kubern

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Teams use elasticsearch and kustomize to deploy and update search clusters across Kubernetes. Kustomize patches base YAML manifests while Elasticsearch stores and indexes your app data.

This workflow lets engineers manage dev, staging, and prod clusters without copying files. You keep one base setup and apply small patches for each stage.

How elasticsearch and kustomize handle permissions and data flow

Kustomize reads your base files and merges stage overlays before applying them. The Kubernetes API receives the final manifests and starts the Elasticsearch pods.

During this step, Kustomize also generates secrets and config maps for the cluster. These objects hold cluster settings, node roles, and initial user keys.

Once the pods run, apps send search queries and log events to Elasticsearch. Each app logs in with an API key or a basic user account.

Elasticsearch checks the user role before it reads or writes any index data. Good role design ensures that staging apps only touch staging indices.

Your deployment pipeline must also log in to both Kubernetes and the search cluster. Kustomize sets up the cluster state, and Elasticsearch enforces the data rules inside.

Common failure modes and how to scope roles

Many teams make the mistake of putting raw admin passwords in Git overlays. Anyone who reads the repo can then log in to the prod cluster.

Instead, store raw keys in an external secret store outside of version control. Let your cluster pull those keys at runtime when the pods start up.

Shared service accounts cause another big issue for growing engineering teams. When five apps share one Elastic key, you cannot tell who ran a bad query.

Shared keys also carry broad permissions so they work for every single app. One leaked key then gives an attacker full write power over all indices.

Elasticsearch Security + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Fix this by creating one narrow role per app or per team workflow. Give log writers permission to append data, and give readers search access only.

Unlogged direct queries from engineer laptops also create blind spots during an incident. Engineers often port-forward to prod pods using a shared admin account to debug issues.

When someone deletes an index by mistake, the audit log shows the shared user. You have no clean way to tie that action to a specific person.

Scoping network paths and stage overlays

Your Kustomize overlays should adjust both pod sizes and network rules per stage. Dev clusters can use smaller disks and fewer nodes to save cloud costs.

Prod overlays must lock down network paths using strict Kubernetes network policies. Only approved app pods in specific namespaces should reach the Elasticsearch HTTP port.

Keep node transport ports closed to all traffic outside the search cluster pods. No client app needs to talk to the internal node coordination port.

Watch out for config drift when engineers run manual patches against live clusters. If someone edits a live stateful set, the next Kustomize run may fail.

Route all manifest changes through your Git workflow so overlays stay the source of truth. Run automated checks on the built YAML output before applying changes to prod.

Finally, protect private user fields stored inside your search documents and app logs. Masking rewrites matched fields like emails, phone numbers, card numbers, and national IDs in results.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Should we store Elasticsearch API keys inside Kustomize secret generators?

No, never commit raw keys or passwords to Git in secret generator files. Use an external secret operator that pulls keys from a safe vault at runtime.

How do we stop engineers from sharing the elastic superuser account?

Turn off shared static passwords for human users and map logins to your identity provider. Assign narrow read or write roles based on each person's team group.

How can we test Kustomize overlays before updating a live search cluster?

Build the final YAML output in your CI pipeline and run schema checks. Apply the changes to a staging cluster first to verify pod rollouts.

The query runs. The emails stay hidden.