Examples using the gcloud CLI to create a user cluster

This page provides examples of using the command gcloud container bare-metal clusters create to create an Google Distributed Cloud user cluster. After creating the user cluster, you need to create at least one node pool. You can use the command gcloud container bare-metal node-pools create to create a node pool. Most of the settings that the commands take correspond to fields in the cluster and node pool configuration file.

For descriptions of the flags, see the following:

Examples creating a cluster

MetalLB

gcloud container bare-metal clusters create user-cluster-1 \
  --project=example-project-12345 \
  --location=europe-west1 \
  --admin-cluster-membership=projects/example-project-12345/locations/global/memberships/admin-cluster-1 \
  --version=1.15.11 \
  --admin-users=sara@example.com \
  --admin-users=amal@example.com \
  --island-mode-service-address-cidr-blocks=10.96.0.0/20 \
  --island-mode-pod-address-cidr-blocks=192.168.0.0/16 \
  --metal-lb-address-pools='pool=pool1,avoid-buggy-ips=True,manual-assign=True,addresses=10.251.134.80/32;10.251.133.0/24;10.251.131.70-10.251.131.74' \
  --control-plane-node-configs='node-ip=10.200.0.10' \
  --control-plane-node-configs='node-ip=10.200.0.11,labels=key2.1=value2.1' \
  --control-plane-node-configs='node-ip=10.200.0.12,labels=key3.1=value3.1;key3.2=value3.2' \
  --control-plane-node-labels=cp-node-pool-key=cp-node-pool-value \
  --control-plane-node-taints=dedicated=experimental:PreferNoSchedule \
  --control-plane-vip=172.16.20.61 \
  --control-plane-load-balancer-port=443 \
  --ingress-vip=10.251.134.80 \
  --lvp-share-path=/mnt/localpv-share \
  --lvp-share-storage-class=local-shared \
  --lvp-node-mounts-config-path=/mnt/localpv-disk \
  --lvp-node-mounts-config-storage-class=local-disks

Optionally, you can include the --metal-lb-load-balancer-node-configs flag if you need to run the load balancer on a dedicated pool of worker nodes. For details see MetalLB nodes.

Manual load balancer

gcloud container bare-metal clusters create user-cluster-2 \
  --project=example-project-12345 \
  --location=europe-west1 \
  --admin-cluster-membership=projects/example-project-12345/locations/global/memberships/admin-cluster-1 \
  --version=1.15.11 \
  --admin-users=sara@example.com \
  --admin-users=amal@example.com \
  --island-mode-service-address-cidr-blocks=10.96.0.0/20 \
  --island-mode-pod-address-cidr-blocks=192.168.0.0/16 \
  --enable-manual-lb \
  --control-plane-node-configs='node-ip=10.200.0.10' \
  --control-plane-node-configs='node-ip=10.200.0.11,labels=key2.1=value2.1' \
  --control-plane-node-configs='node-ip=10.200.0.12,labels=key3.1=value3.1;key3.2=value3.2' \
  --control-plane-node-labels=cp-node-pool-key=cp-node-pool-value \
  --control-plane-node-taints=dedicated=experimental:PreferNoSchedule \
  --control-plane-vip=172.16.20.61 \
  --control-plane-load-balancer-port=443 \
  --ingress-vip=10.251.134.80 \
  --lvp-share-path=/mnt/localpv-share \
  --lvp-share-storage-class=local-shared \
  --lvp-node-mounts-config-path=/mnt/localpv-disk \
  --lvp-node-mounts-config-storage-class=local-disks

Create a node pool

After the cluster is created, you can use the gcloud container bare-metal node-pools create command to create a node pool:

gcloud container bare-metal node-pools create default-pool \
    --cluster=user-cluster-1  \
    --project=example-project-12345 \
    --location=us-west1 \
    --node-configs='node-ip=10.200.0.10' \
    --node-configs='node-ip=10.200.0.11,labels=key2.1=value2.1' \
    --node-labels=node-pool-key=node-pool-value \
    --node-taints=dedicated=experimental:PreferNoSchedule

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

What's next