GKE workloads need to access GCP APIs without managing service account keys.
→Enable and configure Workload Identity on the GKE cluster. Map Kubernetes Service Accounts (KSA) to Google Service Accounts (GSA).
Why: Eliminates the risk of leaked service account keys by using short-lived, automatically-rotated credentials derived from KSA tokens.
Reference↗
Provide access to internal web apps from any network based on user identity and device posture, without a VPN.
→Use Identity-Aware Proxy (IAP) with Access Context Manager. Define access levels based on IP, device state (via Endpoint Verification), and user identity.
Why: Shifts access control from the network perimeter to individual users and devices, enforcing zero-trust principles.
Reference↗
A CI/CD pipeline (e.g., GitHub Actions, GitLab) needs to access GCP resources without long-lived credentials.
→Use Workload Identity Federation. Create a provider pool for the external IdP (e.g., GitHub OIDC) and configure attribute conditions to restrict access to specific repositories or branches.
Why: Keyless authentication for external workloads. The external system provides its own token, which is exchanged for a short-lived GCP token.
Enforce IAM security policies across the entire organization, such as preventing service account key creation or restricting IAM grants to specific domains.
→Use Organization Policy constraints like `iam.disableServiceAccountKeyCreation` and `iam.allowedPolicyMemberDomains`.
Why: Organization Policies are inherited and cannot be overridden by project owners, ensuring consistent security posture.
A user needs temporary, auditable, and approval-gated administrative access to a production environment for an incident.
→Use Privileged Access Manager (PAM) for just-in-time (JIT) access. The user requests a specific role for a limited time, which goes through an approval workflow.
Why: Eliminates standing privileges, a major security risk. Access is time-bound, justified, and fully audited.
Multiple teams share a GKE cluster. Each team must only manage resources within their own namespace.
→Grant IAM role `roles/container.clusterViewer` at the project level. Use Kubernetes RBAC `Role` and `RoleBinding` within each namespace to grant specific permissions (e.g., edit, view).
Why: Separates cluster-level authentication (IAM) from namespace-level authorization (Kubernetes RBAC), providing fine-grained, multi-tenant control.
APIs must be called using short-lived credentials instead of static keys.
→Use service account impersonation. Grant a principal the `roles/iam.serviceAccountTokenCreator` role on a target service account to generate short-lived OAuth 2.0 access tokens.
Why: Avoids distributing and managing long-lived keys. Tokens expire automatically (default 1 hour), reducing risk if compromised.
A contractor needs access to specific resources, but access must automatically expire after 30 days.
→Grant the necessary IAM role with a time-based IAM Condition, e.g., `request.time < timestamp("YYYY-MM-DDTHH:MM:SSZ")`.
Why: Automates access revocation, avoiding manual cleanup and ensuring access is not inadvertently prolonged.
Only allow container images that have been signed by the CI/CD pipeline to be deployed to production GKE clusters.
→Implement Binary Authorization. Create an attestation in the CI pipeline to sign images. Configure a Binary Authorization policy on the GKE cluster to require this attestation.
Why: Enforces a secure software supply chain by preventing unvetted or tampered images from running in production.
Reference↗
Grant permissions to resources based on their assigned tags, not individual resource names.
→Use IAM Conditions with resource tag expressions, like `resource.matchTag("123456789/env", "prod")`.
Why: Enables scalable, attribute-based access control (ABAC). Permissions are dynamic and apply automatically as resources are tagged.
Allow a service project to deploy VMs in a Shared VPC host project without granting network admin rights.
→In the host project, grant the service project's service account the `roles/compute.networkUser` role on the specific subnet(s) it needs to use.
Why: Follows least privilege. Service projects can use the network but cannot modify it (e.g., change firewall rules), which remains centrally managed.
A user with `storage.admin` cannot create a bucket. You need to identify the root cause.
→Check for an IAM Deny Policy at a higher level (folder, org) that denies the `storage.buckets.create` permission.
Why: IAM Deny policies always override any allow policies. This is a powerful tool for enforcing non-negotiable security boundaries.
Enable SSO for on-premises Active Directory users to access the Google Cloud console.
→Use Google Cloud Directory Sync (GCDS) to sync identities to Cloud Identity. Configure federation (SAML) between Cloud Identity and AD FS (or another IdP).
Why: Maintains AD as the source of truth for identities while providing a seamless, federated SSO experience for users.