GKE cluster configuration enables legacy ABAC

Legacy ABAC in GKE adds permissions beyond IAM and RBAC. Prepare the required permissions, disable ABAC, and verify access on the actual cluster.

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

  1. Identify the required operations and prepare IAM permissions and Kubernetes RBAC roles and bindings. Either system can authorize a request.
  2. Keep legacy_abac.enabled set to false for new clusters. For an existing cluster, confirm the project and location, then use gcloud container clusters update with --no-enable-legacy-authorization or the setLegacyAbac API.
  3. Once the update finishes, check the cluster’s legacyAbac.enabled value. 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: yes adds the legacy ABAC grants.
  • After: enabled: no disables those grants. Supply the required IAM permissions and RBAC bindings separately.
  • Both tasks retain master_auth.username and master_auth.password for 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