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

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use kustomize and linkerd to add service mesh rules to Kubernetes apps without templates. Kustomize patches your manifest files while Linkerd secures and routes traffic between running pods. This pairing lets you manage mesh behavior across test and live clusters from one base. You write plain YAML files once and layer mesh annotations per stage. Your app code stays clean while the mesh handles encryption and retries. How kustomize and linkerd handle traffic and permissions Kustomize r

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 linkerd to add service mesh rules to Kubernetes apps without templates. Kustomize patches your manifest files while Linkerd secures and routes traffic between running pods.

This pairing lets you manage mesh behavior across test and live clusters from one base. You write plain YAML files once and layer mesh annotations per stage. Your app code stays clean while the mesh handles encryption and retries.

How kustomize and linkerd handle traffic and permissions

Kustomize reads your base deployment files and applies overlays before sending them to the cluster. You can add mesh annotations at the namespace or pod level during this build step. When the cluster receives these updated manifests, the Linkerd control plane spots the new annotations. An admission webhook then adds the sidecar container to each matching pod spec.

Once the pod starts, the sidecar intercepts all network calls in and out. Linkerd uses Kubernetes service accounts to give each pod a cryptographic identity. The mesh control plane checks this identity and issues short-lived TLS certificates to the sidecar. Pods then talk to each other over mutual TLS without changes to your app code.

Kustomize also manages the custom resources that control mesh routing and traffic splits. You can define service profiles and traffic rules in separate overlay folders for each cluster. The build tool merges these rules with your base manifests during deployment. This setup keeps routing rules in version control alongside the apps they govern.

Common failure modes and how to scope roles

A common mistake is applying mesh injection annotations to every namespace by default. This broad scope can break system pods or batch jobs that do not expect sidecars. Instead, use Kustomize overlays to label only the specific app namespaces that need mesh traffic. Keep cluster system workloads out of the overlay scope.

Shared service accounts create another major risk in a service mesh. If five different apps share the same default service account, they share one mesh identity. Any traffic policy you write for one app will allow all five apps through. You should use Kustomize to generate a dedicated service account for each deployment. Then bind Linkerd authorization policies to those single-purpose accounts.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Broad deployment tokens in your build pipeline can also put your mesh at risk. A pipeline with full cluster admin rights can overwrite mesh control plane settings by mistake. Scope your deployment role so it can only write to target app namespaces. Keep the mesh control plane in a locked namespace with its own admin role.

Managing multi-cluster overlays and certificate updates

Running multiple clusters requires strict control over trust anchors and issuer certificates. If you store raw certificate keys in plain Kustomize bases, anyone with repo read rights can take them. Use external secret tools to load the issuer keys into the cluster at runtime. Let Kustomize manage only the public config maps and resource structures.

Order of operations also matters when you update both app manifests and mesh policies. If a strict policy lands before the sidecar updates, traffic can drop for a short time. Split your Kustomize builds into separate stages for mesh control plane updates and app updates. Run the control plane stage first and check that all core pods are healthy. Then run the app overlay stage to roll out your workload changes safely.

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

Should I add Linkerd sidecar YAML directly to my Kustomize base files?

No, never hardcode the sidecar container spec in your base files. Add the injection annotation in your Kustomize overlay and let the cluster webhook inject the sidecar.

How do I stop batch jobs from hanging when using Kustomize with Linkerd?

Sidecar containers stay running after a batch job finishes its main task. Use a Kustomize patch on your job manifests to skip mesh injection or shut down the sidecar.

Can Kustomize manage Linkerd authorization policies across different stages?

Yes, you can place authorization policy resources in your stage overlays. This lets you test permissive rules in staging while enforcing strict identity rules in production.

Short role checks help teams work fast. Simple rules make each review clear. Good logs keep every team safe. Scoped keys stop bad changes early.

The query runs. The emails stay hidden.