Create a node pool
This page describes how to create a node pool.
Before you begin
This page assumes you are familiar with the cluster autoscaler. For more information, see Cluster autoscaler.
Customize network security groups
To customize a network security group (NSG) for a node pool, see Network security groups.
Create a node pool
Before you create a node pool, you need the following:
- Permissions to use the
az
command-line tool to retrieve an Azure subnet ID. - Access to the cluster's SSH public key.
To create a node pool, run the following commands:
Save your Azure VNet subnet ID and SSH public key to environment variables:
SUBNET_ID=$(az network vnet subnet show \ --resource-group=VNET_RESOURCE_GROUP_NAME --vnet-name=VNET_NAME \ --name default --query "id" -otsv) SSH_PUBLIC_KEY=$(cat KEY_PATH.pub)
Replace the following:
VNET_RESOURCE_GROUP_NAME
: the resource group name that holds VNetVNET_NAME
: the name of your VNetKEY_PATH
: the path to your key pair
Create a node pool with the Google Cloud CLI:
gcloud container azure node-pools create NODE_POOL_NAME \ --cluster CLUSTER_NAME \ --location GOOGLE_CLOUD_LOCATION \ --node-version 1.30.4-gke.400 \ --vm-size VM_SIZE \ --max-pods-per-node 110 \ --min-nodes MIN_NODES \ --max-nodes MAX_NODES \ --ssh-public-key "${SSH_PUBLIC_KEY}" \ --subnet-id "${SUBNET_ID}"
Replace the following:
NODE_POOL_NAME
: a unique name for your node pool—for example,node-pool-1
CLUSTER_NAME
: the name of your GKE on Azure clusterGOOGLE_CLOUD_LOCATION
: the Google Cloud location that manages your clusterVM_SIZE
: a supported Azure VM sizeMIN_NODES
: the minimum number of nodes in the node pool—for more information, see Cluster autoscalerMAX_NODES
: the maximum number of nodes in the node pool
Check the status of your node pool:
gcloud container azure node-pools describe NODE_POOL_NAME \ --cluster CLUSTER_NAME \ --location GOOGLE_CLOUD_LOCATION
Replace the following:
NODE_POOL_NAME
: a unique name for your node pool—for example,node-pool-1
CLUSTER_NAME
: the name of your GKE on Azure clusterGOOGLE_CLOUD_LOCATION
: the Google Cloud location that manages your cluster
The output includes the status of your node pool, including if it is
PROVISIONING
orRUNNING
.
Create a node pool in a specific zone
To create a node pool in a specific Azure availability zone, pass the
--azure-availability-zone
flag to the Google Cloud CLI when you create the node pool.
To create a node pool in a specific Azure availability zone with the Google Cloud CLI, run the following command:
gcloud container azure node-pools create NODE_POOL_NAME \
--cluster CLUSTER_NAME \
--location GOOGLE_CLOUD_LOCATION \
--node-version 1.30.4-gke.400 \
--vm-size VM_SIZE \
--max-pods-per-node 110 \
--min-nodes MIN_NODES \
--max-nodes MAX_NODES \
--azure-availability-zone AZURE_ZONE \
--ssh-public-key "${SSH_PUBLIC_KEY}" \
--subnet-id "${SUBNET_ID}"
Replace the following:
NODE_POOL_NAME
: a unique name for your node pool—for example,node-pool-1
CLUSTER_NAME
: the name of your clusterGOOGLE_CLOUD_LOCATION
: the Google Cloud location that manages your clusterVM_SIZE
: a supported Azure VM sizeMIN_NODES
: the minimum number of nodes in the node pool—for more information, see Cluster autoscalerMAX_NODES
: the maximum number of nodes in the node poolAZURE_ZONE
: the Azure availability zone where GKE on Azure launches the node pool— for example,3
What's next
- View your cluster's status.
- Try the Quickstart to launch your first workload on GKE on Azure.
- Learn about Cluster autoscaler.