The Simplest Way to Make Rancher and Teamcity Work Like They Should
Rancher and TeamCity work together by linking your build server to your clusters. TeamCity builds your app images and tells Rancher to update the running workloads. This workflow turns code changes into live updates without manual steps. Developers push code, TeamCity runs tests, and Rancher rolls out the new containers. When you set up this pair well, your team ships code fast and safe. When you rush the setup, shared keys and broad roles create big risks. How rancher and teamcity share data
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.
Rancher and TeamCity work together by linking your build server to your clusters. TeamCity builds your app images and tells Rancher to update the running workloads.
This workflow turns code changes into live updates without manual steps. Developers push code, TeamCity runs tests, and Rancher rolls out the new containers. When you set up this pair well, your team ships code fast and safe. When you rush the setup, shared keys and broad roles create big risks.
How rancher and teamcity share data and permissions
The link between rancher and teamcity relies on API keys and cluster roles. TeamCity needs a way to log in and talk to the Rancher server. In most setups, an admin creates a service account inside Rancher first. That account gets a role that controls what it can read and write.
Next, the admin saves that token inside the TeamCity project store. When a build finishes, a build runner starts a deploy step. The runner uses the saved token to call the Rancher API over HTTPS. It sends the new image tag and asks Rancher to update the workload.
Data also flows the other way when you run build agents inside Kubernetes. Rancher manages the cluster nodes where those TeamCity agents live and run. TeamCity talks to the cluster to spin up temporary build pods on demand. When the job ends, the cluster deletes the pod to save compute space.
Common failure modes with shared tokens and broad roles
Many teams take shortcuts when they first wire up their build pipelines. The most common mistake is using one admin token for every TeamCity project. If one build script leaks that token, an attacker gains full cluster control. A bad script could also wipe out workloads in the wrong namespace.
Another common issue is storing static keys that never expire. Old tokens sit in build settings for years after staff members leave. When a deploy breaks, nobody knows which job or person ran the bad command. The cluster logs only show the shared service account name, not the real user.
Rancher Access Control + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Network paths between the build server and the cluster also cause trouble. Teams often open the cluster API port to the whole internal network. This lets any machine on the network try to guess keys or run commands.
How to scope roles and network paths
You can fix these risks by tightening roles and network rules right away. Never give a build agent full cluster admin rights in Rancher. Instead, create one narrow role for each project and namespace in your cluster. That role should only allow updating specific workload types in that single namespace.
Give each TeamCity project its own dedicated account and unique key. Disable token sharing across unrelated projects in your build server settings. If a team only deploys to staging, their project should not hold production keys. Rotate these keys on a fixed schedule so old secrets stop working.
Lock down the network path between your build runners and the cluster API. Put your build agents on a private subnet with strict firewall rules. Only allow traffic from known build agent IP addresses to reach the Rancher API. Log every API call so your security team can check what changed and when.
Finally, keep human fixing separate from automated build pipelines. Engineers should not log in to TeamCity just to run ad-hoc cluster commands. Give engineers their own short-lived cluster roles tied to their real work emails. When you split machine traffic from human actions, your audit logs stay clean.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
Should TeamCity use a cluster-wide admin token for Rancher?
No, a cluster-wide token gives every build job far too much power. Create a role scoped to one namespace so each project only touches its own apps.
Where should we run TeamCity build agents when using Rancher?
Run your build agents as pods inside a dedicated Rancher cluster namespace. This keeps build traffic on your private network and scales agents up or down fast.
How do we track which developer triggered a Rancher deploy from TeamCity?
Pass the build number and user ID as labels during the deploy step. You should also use separate accounts for human access versus automated build runners.
Related guides
In this post