Create an A4X Max GKE cluster

This document explains how to deploy a Google Kubernetes Engine (GKE) cluster that uses A4X Max instances. This setup is ideal for running workloads for machine learning (ML) training and high performance computing (HPC).

The A4X Max machine series runs on an exascale platform based on NVIDIA's rack-scale architecture and is optimized for compute and memory-intensive, network-bound ML training and HPC workloads. A4X Max offers bare metal instances, which provide direct access to the host server's CPU and memory, without the Compute Engine hypervisor layer.

To learn more about the A4X machine series, see the A4X Max and A4X machine series section in the Compute Engine documentation.

Before you begin

Before you start, make sure that you have performed the following tasks:

  • Enable the Google Kubernetes Engine API.
  • Enable Google Kubernetes Engine API
  • To use the Google Cloud CLI for this task, install and then initialize the gcloud CLI. If you previously installed the gcloud CLI, get the latest version by running the gcloud components update command. Earlier gcloud CLI versions might not support running the commands in this document.

Required roles

To get the permissions that you need to deploy the cluster, ask your administrator to grant you the following IAM roles:

For more information about granting roles, see Manage access to projects, folders, and organizations.

You might also be able to get the required permissions through custom roles or other predefined roles.

Choose a consumption option and obtain capacity

To obtain capacity, complete the following steps:

  1. Choose a consumption option: Make your choice based on how you want to get and use GPU resources. To learn more, see Choose a consumption option.

    For GKE, consider the following additional information:

    • A4X Max compute instances cannot be provisioned by using flex-start.
    • You must use the reservation-bound provisioning model to create clusters with A4X Max. Other provisioning models are not supported.
  2. Obtain capacity: The process to obtain capacity differs for each consumption option. To learn about the process for your chosen consumption option, see Capacity overview.

Requirements

The following requirements apply to an AI-optimized GKE cluster that uses A4X Max instances:

  • Verify that you use GKE version 1.35.0-gke.2745000 or later (for 1.35), or version 1.34.3-gke.1318000 or later (for 1.34). These versions help ensure that A4X Max uses the following:

    • R580.95.05, which is the minimum GPU driver version for the GB300 GPUs in A4X Max bare metal instances. This driver is enabled by default.
    • Coherent Driver-based Memory Management (CDMM), which is enabled by default. NVIDIA recommends that Kubernetes clusters enable this mode to resolve memory over-reporting. CDMM lets you manage GPU memory through the driver instead of the operating system (OS). This approach helps you avoid OS onlining of GPU memory, and exposes the GPU memory as a Non-Uniform Memory Access (NUMA) node to the OS. Multi-instance GPUs are not supported when CDMM is enabled. For more information about CDMM, see Hardware and Software Support.
    • GPUDirect RDMA, which is recommended to let A4X Max node pools use the networking capabilities of A4X Max.
  • To use GPUDirect RDMA, the GKE nodes must use a Container-Optimized OS node image. Ubuntu and Windows node images are not supported.

Customize the DRANET configuration

This GKE blueprint for A4X Max automatically configures GKE-managed Dynamic Resource Allocation for Networking (DRANET).

When you provision a node pool with DRANET enabled, Cluster Toolkit automatically detects the machine type and requests the Multi-Host Remote Direct Memory Access (MRDMA) interfaces (mrdma.google.com). Cluster Toolkit also creates a ResourceClaimTemplate object named default-rdma in your cluster. If you configure multiple node pools with DRANET, then Cluster Toolkit automatically manages the deployment of templates to prevent conflicts between duplicate resources.

To allocate network devices or change device classes, you can customize the template by using the dranet_allocation_mode, dranet_device_count, and dranet_device_class_name variables in your node pool module settings.

The following example shows how to configure DRANET in a node pool:

  - id: a4x-max-pool
    source: modules/compute/gke-node-pool
    settings:
      enable_dranet: true
      # Optional: Override DRANET template defaults
      # dranet_allocation_mode: ExactCount
      # dranet_device_count: 4

To allocate DRANET resources, do one of the following depending on your deployment method:

  • If you use Cluster Toolkit workload templates, such as the gke-job-template module, then you don't need to configure the resources manually. The toolkit automatically injects the default resource claims into your workloads.
  • If you deploy a custom workload by using a Kubernetes YAML manifest, then you must explicitly configure the claims in your manifest. To configure the claims, do the following:

    • Declare the claim at the Pod level: In the spec.template.spec.resourceClaims section, add a claim that references the default-rdma template:
    spec:
      template:
        spec:
          resourceClaims:
          - name: rdma
            resourceClaimTemplateName: default-rdma
    
    • Bind the claim at the container level: In the resources.claims section in your container definition, add a claim to bind the Pod-level claim that you declared:
    resources:
      claims:
      - name: rdma
    

To view examples of custom workload manifests, see Deploy a workload with RDMA resources or the gke-a4x-max-bm/nccl-jobset-example.yaml example on GitHub.

Create an A4X Max GKE cluster

To create an A4X Max GKE cluster, do the following:

  1. Launch Cloud Shell. Although it's possible to use a different environment, we recommend that you use Cloud Shell because the dependencies are already pre-installed for Cluster Toolkit. If you don't want to use Cloud Shell, then follow the instructions to install dependencies to prepare a different environment.
  2. Create a Cloud Storage bucket to store the state of the Terraform deployment:
        gcloud storage buckets create gs://BUCKET_NAME \
            --default-storage-class=STANDARD \
            --project=PROJECT_ID \
            --location=COMPUTE_REGION_TERRAFORM_STATE \
            --uniform-bucket-level-access
        gcloud storage buckets update gs://BUCKET_NAME --versioning
        

    Replace the following variables:

    • BUCKET_NAME: the name of the new Cloud Storage bucket.
    • PROJECT_ID: your Google Cloud project ID.
    • COMPUTE_REGION_TERRAFORM_STATE: the compute region where you want to store the state of the Terraform deployment.
  3. Choose a consumption option for your GKE deployment:

    By default, the deployment file is configured to consume specific reservations. To use an alternative consumption model , update your deployment YAML file. For more information, see GKE consumption options.

  4. In the examples/gke-a4x-max-bm/gke-a4x-max-bm-deployment.yaml deployment file from the GitHub repository, fill in the following settings in the terraform_backend_defaults and vars sections to match the specific values for your deployment:

    • BUCKET: the name of the Cloud Storage bucket that you created in the previous step.
    • PROJECT_ID: your Google Cloud project ID.
    • DEPLOYMENT_NAME: a unique name for the deployment, which must be between 6 and 30 characters in length. If the deployment name isn't unique within a project, then cluster creation fails. The default value is gke-a4x-max-bm.
    • REGION: the compute region for the cluster.
    • ZONE: the compute zone for the node pool of A4X Max machines. This zone must match the zone where machines are available in your reservation.
    • AUTHORIZED_CIDR: the IP address range that you want to let connect to the cluster. This CIDR block must include the IP address of the machine that calls Terraform. For more information, see How authorized networks work.
    • STATIC_NODE_COUNT: the number of A4X Max nodes in your cluster's node pool, which must be 18 nodes or less. We recommend that you use 18 nodes to obtain the GPU topology of 1x72 in one subblock by using an NVLink domain.
    • For the reservation field, use one of the following, depending on whether you want to target specific blocks in a reservation when you provision the node pool:
      • To place the node pool anywhere in the reservation, provide the name of your reservation (RESERVATION_NAME).
      • To target a specific block within your reservation, use the reservation and block names in the following format:
        RESERVATION_NAME/reservationBlocks/BLOCK_NAME
        If you don't know which blocks are available in your reservation, then see View the topology of a reservation.
    • RESERVATION_PROJECT_ID: the Google Cloud project ID that has the reservation. Your reservation might exist in a different project from PROJECT_ID.
    • NUM_NODE_POOLS: the number of node pools to enable in your cluster. If you want a cluster larger than 18 nodes, then you can specify multiple node pools. The default value is 1.

    To modify advanced settings, edit the examples/gke-a4x-max-bm/gke-a4x-max-bm.yaml file.

  5. Optional: Configure Google Cloud Managed Lustre to provision a managed parallel file system optimized for AI and HPC workloads. The blueprint enables the Managed Lustre CSI driver by default. To configure Managed Lustre for your A4X Max GKE deployment, do the following:
    1. Open the examples/gke-a4x-max-bm/gke-a4x-max-bm.yaml file.
    2. In the vars section, uncomment the Managed Lustre variables lustre_instance_id, lustre_size_gib, and per_unit_storage_throughput.
    3. Find the section commented # --- MANAGED LUSTRE ADDITIONS --- and uncomment the private_service_access, lustre_firewall_rule, managed-lustre, and lustre-pv modules.
  6. Generate Application Default Credentials (ADC) to provide access to Terraform. If you're using Cloud Shell, use the gcloud auth application-default login command:
        gcloud auth application-default login
        
  7. Deploy the blueprint by using the gcluster deploy command to provision the GKE infrastructure with A4X Max machine types:
        cd ~/cluster-toolkit
        ./gcluster deploy -d \
            examples/gke-a4x-max-bm/gke-a4x-max-bm-deployment.yaml \
            examples/gke-a4x-max-bm/gke-a4x-max-bm.yaml
        
  8. When prompted, select (A)pply to deploy the blueprint.
    • The blueprint creates VPC networks, service accounts, a cluster, and a node pool. It also configures GKE-managed Dynamic Resource Allocation for Networking (DRANET).
    • To support the fio-bench-job-template job template, the blueprint creates Google Cloud buckets, network storage, and PersistentVolume resources.

Test network performance

We recommend that you validate the functionality of provisioned clusters. To do so, use NCCL/gIB tests, which are NVIDIA Collective Communications Library (NCCL) tests that are optimized for the Google environment.

Clean up resources

To avoid recurring charges for the resources that you used on this page, use the gcluster destroy command to clean up the resources that are provisioned by Cluster Toolkit, including the VPC networks and the GKE cluster:

cd ~/cluster-toolkit
./gcluster destroy CLUSTER_NAME

Replace CLUSTER_NAME with the name of your cluster.

What's next