You can grant and remove role bindings at the organization and project levels
or revoke active user sessions across zones in Google Distributed Cloud (GDC) air-gapped.
Every subject—a user, group, or service identity—requires an IAMRoleBinding
custom resource linked to an IAMRole custom resource to access resources in
the global API server and Kubernetes clusters. For conceptual background on
additive permissions and global replication, see
Authorization and access control.
This document is for audiences within the platform administrator group and application operator group who manage permissions within GDC organizations and projects. For more information, see Audiences for GDC documentation.
Before you begin
Before managing role bindings or revoking access, you must request the necessary permissions and prepare your environment. The specific roles required depend on whether you're managing organization-level role bindings, managing project-level role bindings, or revoking user access.
Request IAM organization roles
Contact your IAM Org Admin to request the following roles:
- IAM Org Admin (
organization-iam-admin): create, update, and delete role bindings at the organization and project levels. - Session Org Admin (
org-session-admin): revoke a user's active sessions within a specific zone.
Request IAM project roles
Contact your IAM Org Admin or IAM Project Admin to request the following role:
- IAM Project Admin (
project-iam-admin): create, update, and delete role bindings within a specific project. The IAM Org Admin can grant this role for any project within the organization, while the IAM Project Admin can grant this role within the scope of their specific project.
Prepare your environment
To use the command-line tools for managing role bindings or revoking access, complete the following setup:
- Download and install the gdcloud CLI, if you haven't already done so.
- To use the API with the kubectl CLI, complete the following setup:
Find a role's name and namespace
Before you create or delete an IAMRoleBinding resource, look up the target
IAMRole resource's name and namespace on the global API server. You need
these values when you set up role bindings or
remove role bindings.
List organization role details
List the names and namespaces for organization-scoped predefined roles:
kubectl --kubeconfig GLOBAL_API_SERVER_KUBECONFIG \
get iamroles.iam.global.gdc.goog -A \
-l 'user-roles.system.private.gdc.goog/type=predefined,user-roles.system.private.gdc.goog/persona=platform-admin' \
-o custom-columns='NAMESPACE:.metadata.namespace,NAME:.metadata.name,DISPLAY_NAME:.metadata.annotations.user-roles\.system\.private\.gdc\.goog/ui-display-name,PERSONA:.metadata.labels.user-roles\.system\.private\.gdc\.goog/persona,BINDING_TYPE:.metadata.annotations.user-roles\.system\.private\.gdc\.goog/binding-type'
Replace GLOBAL_API_SERVER_KUBECONFIG with the path to
the kubeconfig file for the global API server.
The output is similar to the following:
NAMESPACE NAME DISPLAY_NAME PERSONA BINDING_TYPE
billing-system billing-viewer Billing Viewer platform-admin rolebinding
istio-system web-tls-cert-admin Web TLS Certificate Admin platform-admin rolebinding
platform project-creator Project Creator platform-admin clusterrolebinding
When you set up role bindings using the API, use the
value in the NAMESPACE column for BINDING_NAMESPACE
and the value in the NAME column for ROLE_NAME. The
other columns are for reference only. Regardless of the BINDING_TYPE value,
always create an IAMRoleBinding resource.
List project role details
Project-scoped predefined roles always reside in the target project's namespace. To find a role's name, list the predefined roles in a project:
kubectl --kubeconfig GLOBAL_API_SERVER_KUBECONFIG \
get iamroles.iam.global.gdc.goog -n PROJECT_NAMESPACE \
-l 'user-roles.system.private.gdc.goog/type=predefined,user-roles.system.private.gdc.goog/persona=app-operator' \
-o custom-columns='NAMESPACE:.metadata.namespace,NAME:.metadata.name,DISPLAY_NAME:.metadata.annotations.user-roles\.system\.private\.gdc\.goog/ui-display-name,PERSONA:.metadata.labels.user-roles\.system\.private\.gdc\.goog/persona,BINDING_TYPE:.metadata.annotations.user-roles\.system\.private\.gdc\.goog/binding-type'
Replace the following:
GLOBAL_API_SERVER_KUBECONFIG: the path to the kubeconfig file for the global API server.PROJECT_NAMESPACE: the namespace of the target project.
The output is similar to the following:
NAMESPACE NAME DISPLAY_NAME PERSONA BINDING_TYPE
my-project namespace-admin Namespace Admin app-operator projectrolebinding
my-project project-viewer Project Viewer app-operator rolebinding
When you set up role bindings using the API, use the
value in the NAME column for ROLE_NAME and your
project's namespace (PROJECT_NAMESPACE) for
BINDING_NAMESPACE. The other columns are for reference
only. Regardless of the BINDING_TYPE value, always create an IAMRoleBinding
resource.
Set up role bindings
You can set up role bindings that give team members access to resources at the organization or project level.
Assign a role to an authorized member:
Console
- Sign in to the GDC console.
- From the scope picker in the menu bar, select an organization or project and click Open.
- In the navigation menu, click Identity & Access > Access.
- Click Add Member.
- In the Member type section, select User to add individual users or Group to add groups.
- In the Identity provider list, select an identity provider.
- In the Username or group alias field, enter the username, email address, or alias.
- In the Roles section, select the role that you want to grant to the user or group from the Role 1 list, such as IAM Org Viewer at the organization level or Project Viewer at the project level. To grant multiple roles at a time to the selected user or group, click Add Another Role.
- Click Add.
The member appears in the Authorized members list on the Access page.
gdcloud
Ensure you have the gdcloud CLI installed.
Sign in using the
gdcloud auth logincommand to authenticate with your identity provider. For more information, see gdcloud CLI authentication.Set up role bindings for your target scope:
Organization-level:
gdcloud organizations add-iam-policy-binding ORGANIZATION \ --member=USER_ACCOUNT \ --role=ROLEProject-level:
gdcloud projects add-iam-policy-binding PROJECT \ --member=USER_ACCOUNT \ --role=ROLE
Replace the following variables:
ORGANIZATIONorPROJECT: the name of the organization or project for which you're setting up the role binding.USER_ACCOUNT: the user account to which you want to grant the role. This flag accepts a user email address with the identity provider prefix (user:idpprefix-user@example.com) or a service account name with the service account project (serviceAccount:projectName:serviceAccountName).ROLE: the name of the predefined or custom role you want to assign to the user.
API
You must create the IAMRoleBinding resource in the same namespace as the
target IAMRole resource.
Export the environment variables for the role binding:
export GLOBAL_API_SERVER_KUBECONFIG=GLOBAL_API_SERVER_KUBECONFIG export USERNAME=IDP_PREFIX-USERNAME export ROLE_NAME=ROLE_NAME export BINDING_NAMESPACE=BINDING_NAMESPACE export USER_EMAIL=IDP_PREFIX-USER_EMAILReplace the following:
GLOBAL_API_SERVER_KUBECONFIG: the path to the kubeconfig file for the global API server.IDP_PREFIX: the identity provider prefix.USERNAME: the username portion of the user's email address before the@symbol (such aspaulfrompaul@example.com).ROLE_NAME: the name of theIAMRoleresource to grant (such asproject-creatororproject-viewer). See Find a role's name and namespace or Predefined role permissions.BINDING_NAMESPACE: the namespace where the targetIAMRoleresource resides. Use the target project's namespace for project-scoped roles, or see Find a role's name and namespace for organization-scoped roles.USER_EMAIL: the email address of the user account for which you want to assign the role (such aspaul@example.com).
Create and apply an
IAMRoleBindingcustom resource:cat <<EOF | kubectl --kubeconfig ${GLOBAL_API_SERVER_KUBECONFIG} apply -f - apiVersion: iam.global.gdc.goog/v1 kind: IAMRoleBinding metadata: name: ${USERNAME}-${ROLE_NAME}-binding namespace: ${BINDING_NAMESPACE} spec: roleRef: apiGroup: iam.global.gdc.goog kind: IAMRole name: ${ROLE_NAME} subjects: - apiGroup: rbac.authorization.k8s.io kind: User name: ${USER_EMAIL} EOF
Remove role bindings
When access is no longer required, remove a member and their associated roles, permissions, and access.
To remove members, complete the following steps:
Console
- Sign in to the GDC console.
- From the scope picker in the menu bar, select an organization or project and click Open.
- In the navigation menu, click Identity & Access > Access.
- In the Authorized members list, select one or more members.
- Click Remove All Access to remove all role bindings associated with the selected members from your current organization or project.
- When prompted, enter
removein the Confirm by typing the following below field, and then click Remove to confirm.
gdcloud
Ensure you have the gdcloud CLI installed.
Sign in using the
gdcloud auth logincommand to authenticate with your identity provider. For more information, see gdcloud CLI authentication.Remove role bindings for your target scope:
Organization-level:
gdcloud organizations remove-iam-policy-binding ORGANIZATION \ --member=USER_ACCOUNT \ --role=ROLEProject-level:
gdcloud projects remove-iam-policy-binding PROJECT \ --member=USER_ACCOUNT \ --role=ROLE
Replace the following variables:
ORGANIZATIONorPROJECT: the name of the organization or project from which you're removing the role binding.USER_ACCOUNT: the user account from which you want to remove the role. This flag accepts a user email address with the identity provider prefix (user:idpprefix-user@example.com) or a service account name with the service account project (serviceAccount:projectName:serviceAccountName).ROLE: the name of the predefined or custom role you want to remove from the user account.
kubectl
Delete the IAMRoleBinding to revoke the permission granted to the account:
kubectl --kubeconfig GLOBAL_API_SERVER_KUBECONFIG \
delete iamrolebinding IDP_PREFIX-USERNAME-ROLE_NAME-binding -n BINDING_NAMESPACE
Replace the following:
GLOBAL_API_SERVER_KUBECONFIG: the path to the kubeconfig file for the global API server.IDP_PREFIX: the identity provider prefix.USERNAME: the username portion of the user's email address before the@symbol (such aspaulfrompaul@example.com).ROLE_NAME: the name of theIAMRoleresource to revoke (such asproject-creatororproject-viewer). See Find a role's name and namespace or Predefined role permissions.BINDING_NAMESPACE: the namespace where the targetIAMRoleresource resides. Use the target project's namespace for project-scoped roles, or see Find a role's name and namespace for organization-scoped roles.
Revoke user access
If a member leaves your organization or team, a user with the Session Org Admin
(org-session-admin) role can revoke their active sessions in
Distributed Cloud. Revoking a user's access signs them out of active
sessions in the targeted zone, but doesn't delete their IAMRoleBinding
custom resources or remove their roles and permissions. To permanently remove
the user's roles, follow the steps in
Remove role bindings.
To revoke a user's access across a GDC universe, you must revoke access for each individual zone separately. Complete the following steps for each zone:
Make sure you're signed in to the zone you want to revoke access for. For example, set the zonal URL configuration for gdcloud CLI, and then sign in:
gdcloud config set organization_console_url ZONE_URL gdcloud auth loginReplace
ZONE_URLwith the GDC console URL for the zone to revoke user access for, which resembleshttps://console.ORG_NAME.ZONE_NAME.ORG_SUFFIX.For more information about switching zonal contexts, see Access zones with your tools.
Revoke the user's access for the zone:
gdcloud admin auth revoke --accounts USER_EMAILReplace USER_EMAIL with the email of the user to revoke access.
After running the command, you see output similar to the following. This example revokes access from the user
ariel@example.com:Success: NUMBER of sessions revoked for user ariel@example.comIn this example, the variable NUMBER refers to the number of active sessions the user had.
Confirm you've revoked the user's access by running the
gdcloud admin auth revokecommand again. If successful, you see the following:No sessions found for account: ariel@example.comRepeat the previous steps for each zone in your universe.