Description
GKE’s legacy attribute-based access control (ABAC) grants fixed permissions to identities such as service accounts, nodes and controllers in addition to IAM and RBAC. It is off by default and unavailable in Autopilot.
Potential impact
With ABAC enabled, an authenticated identity can perform operations beyond its RBAC grants. Disabling it before replacing required permissions can interrupt workloads or operator access.
Remediation
- Identify the required operations and prepare IAM permissions and Kubernetes RBAC roles and bindings. Either system can authorize a request.
- Keep
legacy_abac.enabledset tofalsefor new clusters. For an existing cluster, confirm the project and location, then usegcloud container clusters updatewith--no-enable-legacy-authorizationor thesetLegacyAbacAPI. - Once the update finishes, check the cluster’s
legacyAbac.enabledvalue. Test that operators, service accounts and automation can perform required operations and are denied unnecessary ones.
Examples
Before
yaml
- name: create a cluster
google.cloud.gcp_container_cluster:
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: present
legacy_abac:
enabled: yes
After
yaml
- name: create a cluster
google.cloud.gcp_container_cluster:
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: test_project
auth_kind: serviceaccount
service_account_file: /tmp/auth.pem
state: present
legacy_abac:
enabled: no
Explanation:
- Before:
enabled: yesadds the legacy ABAC grants. - After:
enabled: nodisables those grants. Supply the required IAM permissions and RBAC bindings separately. - Both tasks retain
master_auth.usernameandmaster_auth.passwordfor basic authentication, a method GKE removed in 1.19. For current GKE, use OAuth and supply your project and service account JSON file path.
References
- CWE-284
- Ansible gcp_container_cluster documentation
- Cluster module implementation in google.cloud 1.14.0
- GKE recommendation to leave ABAC disabled
- GKE LegacyAbac API field
- IAM and RBAC authorization in GKE
- API for changing ABAC on an existing cluster
- gcloud cluster update options
- GKE API server authentication and legacy authentication limits