GKE Secret Manager Integration

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up gke secret manager integration by linking cloud identities to cluster roles. This link lets pods read external keys without storing plain text in code. Teams often start by granting broad role bindings to get apps running fast. Broad roles let too many users read sensitive keys across the whole cluster. If a developer gets cluster-wide rights, one mistake can expose every secret. How gke secret manager integration works in practice In Kubernetes, role-based rules control who can re

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 set up gke secret manager integration by linking cloud identities to cluster roles. This link lets pods read external keys without storing plain text in code. Teams often start by granting broad role bindings to get apps running fast. Broad roles let too many users read sensitive keys across the whole cluster. If a developer gets cluster-wide rights, one mistake can expose every secret.

How gke secret manager integration works in practice

In Kubernetes, role-based rules control who can read or change cluster objects. A Role sets permissions inside one single namespace. A ClusterRole sets permissions across the entire cluster and covers all namespaces. You attach these rules to users or service accounts with bindings. A RoleBinding grants rights inside one namespace. A ClusterRoleBinding grants rights across the entire cluster at once.

When you set up gke secret manager integration, pods need a clear identity. The cloud platform checks this identity before it hands over any secret value. Inside the cluster, RBAC rules are additive, so there are no deny rules. You must grant only the exact permissions that each app needs to run. If you bind a Secret role at the cluster level, every namespace shares risk.

Teams have two main ways to bring external secrets into their running pods. Some teams mount the secret as a file inside the pod storage volume. Other teams sync the external value into a native Kubernetes Secret object. If you sync into native Secret objects, cluster RBAC rules matter even more. Anyone with read rights on Secrets in that namespace can view the key. You should scope every RoleBinding to one namespace and one service account.

What native secret controls solve and what they leave open

Native secret storage keeps passwords out of source code and build logs. It also lets platform teams rotate keys in one central cloud location. Linking cloud roles to namespace service accounts stops other apps from reading keys. This setup works well for automated workloads that run without human input.

GCP Secret Manager + GKE Workload Identity: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

The gap appears when engineers need to log in and fix live pods. Kubernetes treats pod logs and pod shell sessions as special subresources. In RBAC rules, you write these subresources with a slash after pods. If an engineer has exec rights on a pod, they can run commands. Once inside the container, they can read any mounted secret file or variable.

Native RBAC only checks if a user can start the pod session. It does not check what commands the user runs inside that shell. It also cannot mask sensitive values like emails or card numbers in output. A user who only needs to check app status can read raw keys. Also, native RBAC cannot ask a peer to approve a single command. Teams must manage both static secret storage and live human cluster sessions.

Check Kubernetes API requests and responses on the wire

Kubernetes RBAC decides who may call the API server. RBAC does not check response payloads or split listing Secret names from reading Secret values when a role grants get access. With hoop.dev, you run an open-source HTTP proxy, a sidecar for your Kubernetes API. The kubectl client changes only the server address it talks to while RBAC stays in place.

On each call, hoop.dev guardrails read the method, normalized path, and headers to refuse bad deletes or full Secret reads with a 403 error. On the way back, hoop.dev data masking walks JSON responses by key and masks matched values in Secrets, ConfigMaps, and pod logs. Every request and verdict is logged without storing bearer tokens. View the project on GitHub.

Frequently asked questions

How does Kubernetes RBAC control access to synced secrets?

A Role grants read permissions on Secret objects inside one specific namespace. A RoleBinding links that Role to a specific user or service account. Because RBAC rules are additive, you cannot write a rule to deny access.

Why can users with pod exec rights read secret values?

Pod exec is a subresource that lets a user open a container shell. Once the shell opens, the user has the same file rights as the pod. They can print environment variables or read mounted secret files on disk.

Should we use a RoleBinding or a ClusterRoleBinding for secrets?

You should use a RoleBinding to keep permissions inside one single namespace. A ClusterRoleBinding grants access across all namespaces, which exposes every secret in the cluster. Scoping bindings to one namespace limits the blast radius of a leaked account.

The query runs. The emails stay hidden.