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

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use kustomize and nginx to manage web server rules across many clusters. Kustomize patches base manifests so nginx runs with the right settings in each stage. This workflow stops teams from copying files for test, staging, and prod setups. You keep one clean base folder and layer small changes on top of it. Your build tool reads these layers and sends the final state to the cluster. How kustomize and nginx share data and permissions Kustomize reads plain text files from your code repo

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 kustomize and nginx to manage web server rules across many clusters. Kustomize patches base manifests so nginx runs with the right settings in each stage.

This workflow stops teams from copying files for test, staging, and prod setups. You keep one clean base folder and layer small changes on top of it. Your build tool reads these layers and sends the final state to the cluster.

How kustomize and nginx share data and permissions

Kustomize reads plain text files from your code repo during the build step. It merges your base web server setup with stage patches to build config maps. The cluster then mounts these generated config maps right into the web server pods.

When the web server starts, it reads routing rules and certs from those mounts. Kustomize does not log in to the web server at run time at all. Instead, your deploy pipeline uses a cluster role to write the merged manifests.

The web server pod uses its own service account to read secrets and certs. This split keeps build permissions separate from the running web traffic in your cluster. If you change a routing rule, Kustomize creates a new config map hash. That new hash triggers a safe rolling update for the web server pods.

Common failure modes and how to scope roles

Many teams fail when they share one broad service account across all cluster namespaces. A shared account lets a test deploy change prod web server rules by mistake. Teams also make mistakes when they give deploy tokens full cluster admin rights.

Another big risk happens when engineers edit live config maps by hand during outages. Those unlogged changes vanish on the next deploy and cause repeat site downtime. You can fix this by scoping each deploy role to a single namespace.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Give your build pipeline permission to write only the resources that the app needs. Lock down network paths so only trusted traffic reaches the web server pods. Use network rules to block pods in test namespaces from calling prod services.

Managing patches and cert updates across stages

Keep your base folder small and free of stage names or secret keys. Put replica counts, host names, and cert paths inside your stage overlay folders. This clear split makes code reviews fast and easy for your whole team.

When a cert changes, update the secret generator in the right stage overlay. Kustomize appends a unique suffix to the secret name and updates the pod spec. The cluster rolls out new pods and drops the old ones with zero downtime.

You should also check your merged output in your pipeline before you deploy it. A quick check catches bad syntax before a broken rule reaches your live pods. Store all overlay files in version control so every single change has an owner.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

How does Nginx reload when Kustomize updates a config map?

Kustomize adds a unique hash to the config map name on every file change. This new name updates the pod spec and triggers a clean rolling restart.

Should we store TLS certs directly in Kustomize overlays?

No, never put raw private keys in your code repo or overlay folders. Reference external secret stores or inject certs during the secure deploy pipeline step.

How do we stop teams from deploying test rules to production?

Bind separate service accounts to each namespace with strict role rules in place. Give the test pipeline role write rights only inside the test namespace.

The query runs. The emails stay hidden.