Examples using the gcloud CLI to create a user cluster

This page provides examples of using the command gcloud container vmware clusters create to create a user cluster. After creating the user cluster, you need to create at least one node pool. You can use the command gcloud container vmware node-pools create to create a node pool.

All of the examples use the defaults for the control plane, so those flags aren't included.

DCHP

This section shows examples of getting IP addresses for you cluster nodes from a DHCP server.

MetalLB

gcloud container vmware clusters create user-cluster-1 \
  --project=example-project-12345 \
  --location=us-west1 \
  --admin-cluster-membership=projects/example-project-12345/locations/global/memberships/admin-cluster-1 \
  --version=1.28.300-gke.123 \
  --admin-users=sara@example.com \
  --admin-users=amal@example.com \
  --enable-dhcp \
  --service-address-cidr-blocks=10.96.232.0/24 \
  --pod-address-cidr-blocks=192.168.0.0/16 \
  --metal-lb-config-address-pools='pool=lb-pool-1,manual-assign=False,avoid-buggy-ips=True,addresses=10.251.133.0/24;10.251.134.80/32;10.251.134.81/32' \
  --metal-lb-config-address-pools='pool=lb-pool-2,manual-assign=True,addresses=172.16.20.62/32' \
  --control-plane-vip=172.16.20.61 \
  --ingress-vip=172.16.20.62

For a description of the --metal-lb-config-address-pools flag, see Load balancer.

F5 load balancer

gcloud container vmware clusters create user-cluster-2 \
  --project=example-project-12345 \
  --location=us-west1 \
  --admin-cluster-membership=projects/example-project-12345/locations/global/memberships/admin-cluster-1 \
  --version=1.28.300-gke.123 \
  --admin-users=sara@example.com \
  --admin-users=amal@example.com \
  --enable-dhcp \
  --service-address-cidr-blocks=10.96.232.0/24 \
  --pod-address-cidr-blocks=192.168.0.0/16 \
  --f5-config-address=203.0.113.2 \
  --f5-config-partition=my-f5-admin-partition \
  --control-plane-vip=172.16.20.61 \
  --ingress-vip=172.16.20.62

For a description of the F5 flags, see Load balancer.

Static IPs

This section provides examples using static IPs for your cluster nodes. A user cluster needs to have one IP address for each node and an additional IP address for a temporary node that is needed during cluster upgrades, updates, and auto repair. For a description of the --static-ip-config-ip-blocks flag see Networking.

MetalLB

gcloud container vmware clusters create user-cluster-3 \
  --project=example-project-12345 \
  --location=europe-west1 \
  --admin-cluster-membership=projects/example-project-12345/locations/global/memberships/admin-cluster-1 \
  --version=1.28.300-gke.123 \
  --admin-users=sara@example.com \
  --admin-users=amal@example.com \
  --static-ip-config-ip-blocks='gateway=172.16.23.254,netmask=255.255.252.0,ips=172.16.20.10 user-vm-1;172.16.20.11 user-vm-2' \
  --static-ip-config-ip-blocks='gateway=172.16.23.255,netmask=255.255.252.0,ips=172.16.20.12 user-vm-3;172.16.20.13 extra-vm' \
  --dns-servers=203.0.113.1,198.51.100.1 \
  --dns-search-domains=example.com,altostrat.com \
  --ntp-servers=216.239.35.4,216.239.35.5 \
  --service-address-cidr-blocks=10.96.232.0/24 \
  --pod-address-cidr-blocks=192.168.0.0/16 \
  --metal-lb-config-address-pools='pool=lb-pool-1,manual-assign=False,avoid-buggy-ips=True,addresses=10.251.133.0/24;10.251.134.80/32;10.251.134.81/32' \
  --metal-lb-config-address-pools='pool=lb-pool-2,manual-assign=True,addresses=172.16.20.62/32' \
  --control-plane-vip=172.16.20.61 \
  --ingress-vip=172.16.20.62

Manual load balancer

gcloud container vmware clusters create user-cluster-4 \
  --project=example-project-12345 \
  --location=asia-east1 \
  --admin-cluster-membership=projects/example-project-12345/locations/global/memberships/admin-cluster-1 \
  --version=1.28.300-gke.123 \
  --admin-users=sara@example.com \
  --admin-users=amal@example.com \
  --static-ip-config-ip-blocks='gateway=172.16.23.254,netmask=255.255.252.0,ips=172.16.20.10 user-vm-1;172.16.20.11 user-vm-2' \
  --static-ip-config-ip-blocks='gateway=172.16.23.255,netmask=255.255.252.0,ips=172.16.20.12 user-vm-3;172.16.20.13 extra-vm' \
  --dns-servers=203.0.113.1,198.51.100.1  \
  --ntp-servers=216.239.35.4,216.239.35.5 \
  --service-address-cidr-blocks=10.96.232.0/24 \
  --pod-address-cidr-blocks=192.168.0.0/16 \
  --control-plane-vip=172.16.20.61 \
  --control-plane-node-port=30968 \
  --ingress-vip=172.16.20.62 \
  --ingress-http-node-port=32527 \
  --ingress-https-node-port=30139 \
  --konnectivity-server-node-port=30969

Create a node pool

You can use the following command to create a node pool:

gcloud container vmware node-pools create default-pool \
    --cluster=user-cluster-1  \
    --project=example-project-12345 \
    --location=us-west1 \
    --image-type=ubuntu_containerd  \
    --boot-disk-size=40 \
    --cpus=8 \
    --memory=8192 \
    --replicas=5  \
    --min-replicas=5  \
    --max-replicas=10  \
    --enable-load-balancer
  

For descriptions of the flags, see Create a node pool.

What's next