The Simplest Way to Make Crossplane and Teamcity Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

You pair Crossplane and TeamCity to build cloud resources right from your code pipelines. TeamCity runs the build steps, while Crossplane turns cluster manifests into real cloud servers. This setup lets app teams ask for databases or buckets through git commits. The build server checks the manifest files and sends them to the control cluster. From there, the cluster talks to the cloud provider and makes the new resource. How Crossplane and TeamCity share keys and data To work together, the b

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 Crossplane and TeamCity to build cloud resources right from your code pipelines. TeamCity runs the build steps, while Crossplane turns cluster manifests into real cloud servers.

This setup lets app teams ask for databases or buckets through git commits. The build server checks the manifest files and sends them to the control cluster. From there, the cluster talks to the cloud provider and makes the new resource.

How Crossplane and TeamCity share keys and data

To work together, the build server must talk to the Kubernetes control plane. A TeamCity build agent needs a valid role and key to reach the cluster. During a run, the agent reads the resource files from your source code repo. Then it sends those files to the cluster API server over the network.

Crossplane watches the cluster API for these new resource claims. When a claim arrives, the tool matches it against its provider rules. It uses its own cloud provider keys to create the database or storage bucket. Once the cloud resource is ready, the cluster writes the output details to a secret.

Next, the TeamCity agent checks the status of the resource claim. It waits until the cluster marks the new cloud resource as ready for use. This flow keeps cloud provider keys inside the cluster instead of on build agents. Still, the build agent holds a strong key that can change cluster state.

Common failure modes in build and cluster permissions

Many teams give their build agents a single shared admin role on the cluster. If one build project getscompromised, an attacker can read or delete every resource. Broad cluster tokens also let any pipeline change provider settings or read app secrets. When multiple agents share one service account, your team cannot tell who ran a command.

Unlogged changes create another big risk for operations teams. Standard cluster logs only show that the shared build account changed a resource claim. They do not show which developer or build run triggered that specific change. When a database disappears, you waste hours matching build logs to cluster events.

Crossplane Composition Security + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

To fix this, give each TeamCity project its own scoped cluster service account. Map each service account to a single namespace using strict role rules. Only allow the build agent to read and write the specific claim types it needs. Never let a build agent edit the core provider settings or read unrelated secrets.

Scoping network paths and build agent roles

Good role scope is only half of the security puzzle for your pipelines. You also need to lock down the network path between agents and the cluster. Do not open your cluster API server to the public internet for cloud agents. Place your self-hosted build agents inside a private network that can reach the cluster.

Rotate the keys that your build agents use on a regular schedule. Short token lifetimes limit the damage if a build log leaks a key by mistake. You should also check resource claims for mistakes before the agent sends them out. Run a check step in your pipeline to catch bad sizes or public network rules.

Keep your provider keys separate from your app deployment roles at all times. Put platform engineers in charge of the base templates and provider roles. Let app developers only trigger claims through tested pipeline steps in their own projects. This split keeps cloud costs down and stops bad changes before they reach production.

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

Should TeamCity hold cloud provider keys when using Crossplane?

No, the build server only needs a key to talk to the Kubernetes cluster. The cluster holds the cloud keys and makes the actual cloud resources.

How do we stop one build project from changing another team's cloud resources?

Give each TeamCity project a unique cluster role tied to a single namespace. Then use role rules so the agent can only create scoped resource claims.

How can we track which build run changed a cloud resource?

Add build metadata labels to your resource claims during the pipeline run. Also use unique service accounts per project so cluster logs show the exact source.

The query runs. The emails stay hidden.