The Simplest Way to Make Crossplane and IAM Roles Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Crossplane and IAM roles work together to build cloud resources from Kubernetes clusters. You bind a cluster service account to a cloud role for safe provisioning. This workflow lets platform teams manage databases, buckets, and networks through standard cluster manifests. Teams do not need to store static cloud keys inside cluster secrets. Instead, the control plane trades short cluster tokens for temporary cloud permissions. This keeps long-lived keys out of version control and build pipeline

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.

Crossplane and IAM roles work together to build cloud resources from Kubernetes clusters. You bind a cluster service account to a cloud role for safe provisioning.

This workflow lets platform teams manage databases, buckets, and networks through standard cluster manifests. Teams do not need to store static cloud keys inside cluster secrets. Instead, the control plane trades short cluster tokens for temporary cloud permissions. This keeps long-lived keys out of version control and build pipelines. Developers request resources through simple files while cloud admins keep strict control over permissions.

How crossplane and iam roles handle permissions and data flow

The link between crossplane and iam roles starts inside your Kubernetes cluster. Crossplane runs provider pods that talk to external cloud APIs on your behalf. Each provider pod uses a local Kubernetes service account for its identity. The cluster issues a signed token to that service account at runtime. The provider pod sends this token to the cloud identity service.

The cloud identity service checks the token against a trusted identity provider list. If the token is valid, the cloud service returns temporary role credentials. The provider pod uses these temporary credentials to create, update, or delete cloud resources. Data flows from your declarative cluster state out to the cloud provider API. The control plane checks the cloud resource state and updates the cluster status. When the temporary credentials expire, the provider pod requests a fresh set. No human needs to rotate static keys or copy secrets between systems.

Common failure modes and how to scope roles

Many teams fail by binding one broad admin role to a single provider pod. If any team can submit manifests to that provider, anyone can build anything. A developer might create a public storage bucket or delete a shared database. Shared service accounts also ruin your cloud audit logs. Every API call in the cloud log points back to the same provider role. You cannot tell which team or cluster namespace triggered the cloud change.

To fix this, split your provider configs by team, namespace, or environment. Create a separate cloud role for each domain with only the needed permissions. A database provider role should only manage database instances and nothing else. A storage role should only touch buckets in one specific project or account. Map each scoped cloud role to its own dedicated provider config in the cluster.

AWS IAM Policies + Lambda Execution Roles: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

You should also lock down the trust policy on each cloud role. Require the exact cluster issuer URL and the exact service account name. Never use wildcards in the subject field of a role trust policy. Next, restrict network paths from the cluster to the cloud API endpoints. Allow outbound traffic from provider pods only to the required cloud management domains. Finally, log both Kubernetes API events and cloud role assumption events in one place. This lets security teams trace a cloud resource back to the exact user commit.

Day two operations and role lifecycle

Once your roles are running, you must review their permissions on a regular schedule. Cloud needs change as teams add new resource types to their cluster compositions. Start with read and write rules for only the exact services in your compositions. Watch cloud denial logs during testing to find missing permissions before production rollout. When a team retires a composition, remove those unused permissions from the cloud role. Keep role session lifetimes short so revoked rules take effect within an hour. Separate roles that create resources from roles that apps use at runtime. A database provider creates the database, while a separate app role reads the data. This split stops a broken app from deleting its own backing cloud resource.

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

Why should we avoid static cloud keys in Crossplane providers?

Static keys never expire on their own and can leak from cluster secrets. Identity federation uses short tokens that rotate without human work and reduce leak risk.

Should every team share one IAM role for all cloud provisioning?

No, sharing one role gives every team the same wide cloud permissions. Give each team or namespace a dedicated role scoped only to their needed resources.

How do we audit which user created a cloud resource through Crossplane?

Pair Kubernetes audit logs with cloud identity logs using timestamps and role names. Scoped roles per namespace make it easy to match cluster changes to cloud calls.

The query runs. The emails stay hidden.