To create a node pool in Anthos clusters on AWS, you must provide the following resources:
- The name of an existing AWS cluster to create the node pool in
- An IAM instance profile for node pool VMs
- A subnet where the node pool VMs will run
If you want SSH access to your nodes, you can Create an EC2 key pair. Once these resources are available, you can create a node pool with this command:
gcloud container aws node-pools create NODE_POOL_NAME \ --cluster CLUSTER_NAME \ --instance-type INSTANCE_TYPE \ --root-volume-size ROOT_VOLUME_SIZE \ --iam-instance-profile NODEPOOL_PROFILE \ --node-version NODE_VERSION \ --min-nodes MIN_NODES \ --max-nodes MAX_NODES \ --max-pods-per-node MAX_PODS_PER_NODE \ --location GOOGLE_CLOUD_LOCATION \ --subnet-id NODEPOOL_SUBNET \ --ssh-ec2-key-pair SSH_KEY_PAIR_NAME \ --config-encryption-kms-key-arn CONFIG_KMS_KEY_ARN \ --tags "Name=CLUSTER_NAME-NODE_POOL_NAME"
Replace the following:
NODE_POOL_NAME: a name you choose for your node pool
CLUSTER_NAME: the name of the cluster to attach the node pool to
INSTANCE_TYPE: the desired AWS machine instance type for this node pool— for example,
ROOT_VOLUME_SIZE: the desired size for each node's root volume, in Gb
NODEPOOL_PROFILE: the IAM instance profile for node pool VMs
NODE_VERSION: the Kubernetes version to install on each node in the node pool (e.g., "1.24.5-gke.200")
MIN_NODES: the minimum number of nodes the node pool can contain
MAX_NODES: the maximum number of nodes the node pool can contain
MAX_PODS_PER_NODE: the maximum number of pods that can be created on any single node in the pool
GOOGLE_CLOUD_LOCATION: the name of the Google Cloud location from which this node pool will be managed
NODEPOOL_SUBNET: the ID of the subnet the node pool will run on.
- There must not be any overlap between the cluster's Pod/Service IP ranges and the node pool subnet network. For more information on selecting Pod and Service IP ranges for your cluster, see Select CIDR ranges for your cluster
- If this subnet is outside of the VPC primary CIDR block, some additional steps are needed. For more information, see security groups.
SSH_KEY_PAIR_NAME: the name of the AWS SSH key pair created for SSH access (optional)
CONFIG_KMS_KEY_ARN: the Amazon Resource Name (ARN) of the AWS KMS key that encrypts user data
If present, the
--tags parameter applies the given tag to all nodes in your
node pool. This example tags all nodes in the pool with the names of the cluster
and node pool the node belongs to.