Stay organized with collections
Save and categorize content based on your preferences.
When you deploy to Google Kubernetes Engine (GKE), the default Cloud Deploy
execution service account
has access to all namespaces in the target cluster. You can configure that
service account to deploy to only one namespace.
Ensure that the execution service account doesn't have the
roles/container.developer IAM role.
Grant the service account the roles/container.clusterViewer role.
This role allows the service account to authenticate on the cluster, but do
nothing else.
Create a Kubernetes RBAC Role that grants admin access to the namespace.
The RBAC role in this example has broad permissions, equivalent to the
clouddeploy.developer IAM role.
To minimize the risk of privilege escalation, we recommend you change these
permissions to the minimum required for your applications. For instructions,
see the RBAC documentation for GKE.
Create a RoleBinding that binds that RBAC Role in your chosen
namespace to the Cloud Deploy execution service account:
kind:RoleBindingapiVersion:rbac.authorization.k8s.io/v1metadata:name:adminnamespace:NAMESPACEsubjects:# Google Cloud user account-kind:Username:SERVICE_ACCOUNTroleRef:kind:Rolename:adminapiGroup:rbac.authorization.k8s.io
This manifest defines an RBAC policy binding the admin Role to your execution
service account. NAMESPACE is the namespace for
which you want to grant the service account access. The service account can't
access any other namespace on the cluster.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-21 UTC."],[[["By default, Cloud Deploy's execution service account has access to all namespaces in a GKE cluster, but this can be configured to restrict access to a single namespace."],["Remove the `roles/container.developer` IAM role from the execution service account and grant it the `roles/container.clusterViewer` role for authentication."],["Create a Kubernetes RBAC Role to provide the necessary admin access within the specified namespace, adjusting permissions as needed for the applications, and this Role is equivalent to the `clouddeploy.developer` IAM role."],["Create a RoleBinding to link the RBAC Role to the Cloud Deploy execution service account, limiting its access to the specified namespace only."],["Apply the created RBAC manifest to the cluster to enforce the namespace-specific access restrictions."]]],[]]