Find Your Layout
Workspaces
This page says workspace for whatever unit you already use to separate workloads. Each workspace runs its own Sidecar, in front of the databases and services its workload uses:
The examples name namespaces
ws-acme, ws-beta and so on, so one pattern (ws-*) can match them all. Use your own naming scheme.
How Mapping Works
- One credential, one Sidecar. A token is a Sidecar. A service account reaches the Sidecar its entry renders.
- The name is the only key. Every pod that renders the same name reaches the same Sidecar and runs the same configuration. That includes restarts, replicas, other namespaces, other clusters and other projects.
- The configuration belongs to the Sidecar, not the pod. The first pod to reach a new Sidecar imports its local config file. Every later pod runs what the Control Plane holds, whatever its own file says.
- One credential per Sidecar. A token, a Kubernetes service account or a Google service account. Never two at once.
Credential Types
All three can run side by side on one Control Plane.
Layouts
Each layout has the same parts: when to use it, a diagram, the Control Plane entry and the Helm values, and the Sidecars that result. Every entry is created with the same call, as an admin:Token per Sidecar
Use when: you run a few Sidecars, or the pods have no Kubernetes or Google identity. This is the standard flow.
The same token in two deployments is the same Sidecar, with one configuration. See Connect a Sidecar.
Kubernetes SA per Namespace
Use when: you run one cluster and want one Sidecar per namespace, with no step before each deploy. Every workspace namespace has a service account with the same name. The namespace is part of the identity, so each namespace is its own Sidecar.kubectl get --raw /.well-known/openid-configuration | jq -r .issuer.
Kubernetes SA Across Clusters
Use when: you run several clusters and want one Sidecar per namespace, per cluster. Each cluster is its own issuer, so each cluster needs its own entry. Give each entry its own name prefix, so namespaces with the same name in two clusters stay two Sidecars.Google SA per Workspace
Use when: you run on Google Cloud and want one Sidecar per workload, with one entry for any number of clusters, VMs and Cloud Run services. Each workspace runs as its own Google service account: on GKE through Workload Identity, or as the service account of a VM or Cloud Run service.
The Google service account needs no IAM role of its own. On GKE, the Workload Identity binding is what ties the Kubernetes service account to it, and Google enforces it:
- The cluster needs Workload Identity (
--workload-pool, on by default on Autopilot), and the project needsiamcredentials.googleapis.com. See Service Accounts. - A new binding takes a minute or two to apply. Until then the pod exits with
403 … getOpenIdToken, and it enrolls on a later restart. - A pod without the annotation does not fall back to the node’s service account. It exits with the metadata server’s
404, and the Control Plane never sees it.
--set-string "serviceAccount.annotations.iam\.gke\.io/gcp-service-account=sidecar-acme@my-project.iam.gserviceaccount.com".
Shared Identity
Use when: a team, tenant, user or environment is your policy unit, and all of its workspaces run the same services. When several workspaces present the same identity, they are one Sidecar. This holds for every credential type. Here, the payments team runs two workspaces in the EU cluster and one in the US cluster, all as the team’s service account:
What sharing means in practice:
The same applies to Kubernetes identities: replicas, or several Deployments in one namespace that use one service account, are one Sidecar.
Kubernetes SA per Team
Use when: each team (or tenant, or user) has its own Kubernetes service account name, used in several namespaces, and you want one Sidecar per namespace. The namespace is in the subject, so a Kubernetes identity separates the namespaces. But a pattern allows one*, so the team’s name must be literal: one entry per team per cluster.
A single pattern for every team, such as
system:serviceaccount:*, would capture payments-api:team-payments. A Sidecar name may hold only letters, digits, -, _ and ., so the Control Plane refuses it: … renders the sidecar name "…", which is refused.
Pinned Sidecar
Use when: one workspace needs a name you choose, it falls outside your naming scheme, or a namespace was renamed and should keep its Sidecar. An exactsubject_pattern with a literal name_template maps one identity to one Sidecar. Exact entries win over wildcard ones, so a pinned entry also overrides a wildcard for that one identity.
entry.json
After a rename, point the pinned entry at the new subject with the old name, then clear the binding.
Token-to-Identity Migration
Use when: you already run token Sidecars and want to move them to service accounts, keeping their names and configuration. A Control Plane serves token Sidecars and service-account Sidecars at the same time. Render each Sidecar’s existing name and setadopt_existing_sidecars:
adopt_existing_sidecars back to false once every workspace has moved. See Moving token Sidecars to service accounts.
Multiple Organizations
Use when: one Control Plane serves several organizations. An issuer and audience pair belongs to one organization. All Google service accounts share the issuerhttps://accounts.google.com, and all Sidecars in one cluster share that cluster’s issuer. So each organization picks its own audience:
kubernetes) or in HOOP_SIDECAR_IDENTITY_AUDIENCE (gcp). A Control Plane with one organization leaves it empty.
Pattern Cheat Sheet
subject_pattern takes an exact value or one *. name_template puts the text that * matched where it says {1}. The rendered name must be 3–254 characters: letters, digits, -, _ and ..
Google entries must use
claim: email and end in a literal @<project>.iam.gserviceaccount.com. A bare * needs allow_any_subject and is refused for Google. See The entry.
Check the Result
List every Sidecar with the identity bound to it:Layout Comparison
Limitations
Next
Service Accounts
Entry fields, the handshake and troubleshooting.
Connect a Sidecar
Tokens, the license and staying in sync.