The Simplest Way to Make CircleCI and Kustomize Work Like They Should
You pair circleci and kustomize to build and ship Kubernetes manifests without duplicating YAML files. CircleCI runs your build steps while Kustomize patches base manifests for each target cluster. This workflow keeps your app settings clean across test, staging, and production clusters. Teams store base files in Git and apply small overlays during each pipeline run. Your build runner compiles the final manifest and sends it to the Kubernetes API. How circleci and kustomize handle identity an
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.
You pair circleci and kustomize to build and ship Kubernetes manifests without duplicating YAML files. CircleCI runs your build steps while Kustomize patches base manifests for each target cluster.
This workflow keeps your app settings clean across test, staging, and production clusters. Teams store base files in Git and apply small overlays during each pipeline run. Your build runner compiles the final manifest and sends it to the Kubernetes API.
How circleci and kustomize handle identity and data flow
Data flows from your source repo into the CircleCI runner during each job. The runner pulls your repo, reads the base YAML files, and merges the target overlay. Kustomize runs inside the build container and outputs a single combined manifest stream.
Next, the runner must log in to your Kubernetes cluster to apply those changes. Most teams use OpenID Connect tokens or static service account keys stored in CircleCI contexts. The runner sends the rendered YAML to the cluster API server over HTTPS.
Kustomize itself does not log in to clusters or hold secret keys. It only transforms text files on the runner disk before the deploy step begins. All identity checks happen between the CircleCI job and the target Kubernetes API.
Common failure modes and how to scope roles
A common mistake is giving CircleCI a cluster admin role for all deploy jobs. If a build script leaks that token, an attacker gains full control of your cluster. Shared service accounts also make it hard to see which job changed a resource.
Broad contexts in CircleCI create another big risk for engineering teams. Any developer who can edit the pipeline file can read secrets from a shared context. A test branch could use production keys and overwrite live app settings by mistake.
To fix this, create separate Kubernetes roles for each namespace and app team. Bind each role to a specific project branch using OpenID Connect claims. Never let a feature branch job hold write permissions for your production namespace.
End-to-End Encryption + Kustomize Security Overlays: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
You should also validate Kustomize output before the runner talks to the cluster. Run a dry check in an isolated step that has zero network credentials. Only pass the rendered files to the deploy step after all policy checks pass.
Keep secret values out of your Git overlays whenever you can. Fetch sensitive values during the deploy step or use an external secret store in the cluster. If logs contain PII like emails or phone numbers, masking rewrites matched fields in results.
Auditing manifest changes across clusters
Unlogged cluster writes make incident response slow and painful for platform teams. Standard build logs show that a job ran, but rarely capture the exact YAML diff. You need a clear record of what Kustomize rendered and who approved the run.
Save the compiled manifest output as a build artifact on every production run. Match those artifacts with Kubernetes audit logs to track every single resource change. Restrict network paths so only approved runners can reach your private cluster API endpoints.
Review your role bindings every quarter to remove old pipeline identities. Small, scoped permissions keep your delivery pipeline safe when build scripts fail.
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 Kustomize run in the same step as the cluster deploy?
No, split rendering and deploying into two separate pipeline jobs. Render and check the YAML in a job with no cluster credentials first. Run the deploy step only after the build artifact passes all checks.
How do we handle secrets with circleci and kustomize?
Do not commit raw secrets into your Kustomize overlay files in Git. Store encrypted secrets in your repo or inject them from a secret manager at runtime. Always scope CircleCI contexts so only protected branches can read production keys.
How can we stop test branches from changing production clusters?
Use branch filters on your CircleCI workflows and restrict your Kubernetes role bindings. Set up OpenID Connect rules that verify the exact Git branch name before granting write permissions. This blocks test runs from touching live namespaces even if someone edits the pipeline file.
Related guides
In this post