The Simplest Way to Make Kustomize and Tcp Proxies Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Using kustomize and tcp proxies together lets teams manage network routing across clusters with declarative overlays. Kustomize patches cluster manifests, while the network layer routes traffic to the right backend pods. This setup keeps your base YAML files clean and reusable for every stage. Teams can change ports, hostnames, and routing rules without copying entire manifest files. Developers push updates through version control, and the cluster updates the network rules on its own. How kus

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.

Using kustomize and tcp proxies together lets teams manage network routing across clusters with declarative overlays. Kustomize patches cluster manifests, while the network layer routes traffic to the right backend pods.

This setup keeps your base YAML files clean and reusable for every stage. Teams can change ports, hostnames, and routing rules without copying entire manifest files. Developers push updates through version control, and the cluster updates the network rules on its own.

How kustomize and tcp proxies manage traffic flow

In a standard cluster, apps need a safe way to talk to internal databases and services. Kustomize reads a base manifest and applies specific overlays for test, staging, or production stages. These overlays define the service ports, replica counts, and network paths for the routing pods.

When a user or service sends data, the traffic hits the outer network endpoint first. The routing pod checks the incoming port and forwards the raw stream to the target pod. Because Kustomize controls the deployment files, each stage gets its own strict set of target addresses.

Log in checks and role checks depend on how you set up the cluster permissions. Kustomize binds specific service accounts to the routing pods during the build step. The cluster then checks these roles before allowing the pod to read secrets or open connections. Data flows in a straight line from the client to the router to the backend app.

Common failure modes and how to scope roles

Many teams run into trouble when they share one service account across multiple overlays. If a staging overlay uses a production role, a test pod might reach live data. Broad tokens also create risk when a single routing pod forwards traffic to too many backends.

Another common issue is unlogged traffic passing through raw socket connections. Standard network routers move packets without recording who ran a query or changed a record. If a port mapping in a Kustomize patch is wrong, traffic can go to the wrong database. Teams often struggle to spot these mistakes until an app breaks or an audit fails.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

To fix this, give every overlay its own service account and strict role bindings. Scope each network pod so it only routes traffic to one specific backend service. Use Kubernetes network policies in your base files to block all unauthorized pod-to-pod paths.

Keeping overlays clean across multiple clusters

As your team grows, the number of patches for network rules can get messy. Keep your base manifests small and put only the shared port definitions in them. Place all hostnames, IP lists, and role names inside the stage-specific overlay folders.

Run automated checks in your build pipeline before sending manifests to the cluster. Check that no test overlay points to a production address or uses a broad cluster role. This habit stops bad network paths before they ever reach a live cluster.

Review your routing logs and role bindings every month to remove unused ports. Removing old patches keeps your repo easy to read and lowers your risk surface. When every network path is clear in version control, teams ship updates with less fear.

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 do I change routing ports for different stages?

Put your default port numbers in the Kustomize base manifest. Then create a patch in each stage overlay to replace those numbers with stage-specific ports.

Why should each overlay have its own service account?

Separate service accounts stop test or staging pods from reaching production resources. If one stage gets compromised, the attacker stays trapped in that single scope.

Can Kustomize manage network policies along with routing pods?

Yes, you can include Kubernetes network policy files right inside your Kustomize base. Overlays can then adjust the allowed pod labels and IP blocks for each cluster stage.

The query runs. The emails stay hidden.