The Simplest Way to Make Kustomize and Teamcity Work Like They Should
You pair kustomize and teamcity to build and deploy clean cluster manifests. TeamCity runs your build steps while Kustomize patches base files for each stage. This setup lets your team ship app changes without copying YAML files. You keep one base set of files and apply small overlays per stage. TeamCity handles the triggers, runs the checks, and pushes the final output. How kustomize and teamcity share permissions and data The workflow between kustomize and teamcity starts in your source co
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 kustomize and teamcity to build and deploy clean cluster manifests. TeamCity runs your build steps while Kustomize patches base files for each stage.
This setup lets your team ship app changes without copying YAML files. You keep one base set of files and apply small overlays per stage. TeamCity handles the triggers, runs the checks, and pushes the final output.
How kustomize and teamcity share permissions and data
The workflow between kustomize and teamcity starts in your source code repo. Developers push base manifests and stage overlays to a shared git branch. TeamCity watches this branch and pulls the files onto a build agent.
Next, the build agent runs Kustomize to merge the base and overlay files. Kustomize reads the local files and outputs a single stream of plain YAML. It does not need cluster keys just to build this text output.
The agent then needs a role and a key to send the YAML. TeamCity holds the cluster credentials or cloud roles inside its secure store. During the deploy step, the agent logs in and applies the rendered manifests.
If Kustomize pulls remote bases from private repos, the agent needs git keys. You set up TeamCity to pass an SSH key to the agent. This lets the build step read remote files without exposing keys in code.
Common failure modes and how to scope roles
Teams often fail by giving build agents one broad cluster admin token. If one project build gets compromised, the attacker gains control over every namespace. Shared service accounts also make it hard to see who changed what.
Another common problem happens when build agents store static keys on disk. Old tokens stay on the machine long after the build job ends. Any other job on that same agent can read those leftover keys.
End-to-End Encryption + Kustomize Security Overlays: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Unlogged deploys also hurt teams during an outage or security review. When four pipelines share one role, cluster logs show the same user name. You cannot trace a bad manifest back to a single TeamCity build run.
To fix this, give each TeamCity project its own scoped cluster role. Limit each role so it can only write to one target namespace. Never share deploy keys across dev, staging, and production build jobs.
You should also lock down network paths between build agents and clusters. Put production build agents in a separate pool with strict network rules. Only allow that specific agent pool to reach your production cluster API.
How to validate manifests before the deploy step
Bad YAML patches can break a deploy halfway through a build run. You should check the Kustomize output before the agent talks to the cluster. Add a fast check step right after Kustomize builds the final manifest.
This step reads the output and checks it against cluster schema rules. It catches typos, missing labels, and bad resource limits in seconds. If the check fails, TeamCity stops the pipeline before touching live workloads.
You can also save the rendered YAML as a TeamCity build artifact. This gives your team a clear record of the exact file sent out. During an incident, engineers can read that file to spot bad changes fast.
Add runtime guardrails and masking beside your databases and APIs
Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.
Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.
Frequently asked questions
Does Kustomize need cluster credentials during the build step?
No, Kustomize only reads local files and merges them into plain YAML text. Only the deploy tool that runs after Kustomize needs cluster keys.
Where should we store image tag updates in this workflow?
Let TeamCity pass the new build number to Kustomize during the pipeline run. Commit the updated overlay file back to git if you want a full history.
How do we stop dev pipelines from deploying to production?
Split your TeamCity agents into separate pools for dev and production workloads. Assign scoped cluster roles to each pool so dev agents lack production rights.
Related guides
In this post