Examples using the gcloud CLI to create a user cluster
Stay organized with collections
Save and categorize content based on your preferences.
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.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["This page provides examples of using the command\n`gcloud container bare-metal clusters create` to create an\nGoogle Distributed Cloud user cluster. After creating the user cluster, you\nneed to create at least one node pool. You can use the command\n`gcloud container bare-metal node-pools create` to\n[create a node pool](#create_a_node_pool). Most of the settings that the\ncommands take correspond to fields in the cluster and node pool\n[configuration file](/kubernetes-engine/distributed-cloud/bare-metal/docs/reference/cluster-config-ref).\n| **Important:** These are examples. You must replace the IP addresses and CIDR ranges with values from your network.\n\nFor descriptions of the flags, see the following:\n\n- [Create a user cluster](/kubernetes-engine/distributed-cloud/bare-metal/docs/installing/creating-clusters/create-user-cluster-api#create_a_user_cluster)\n- [The gcloud CLI reference](/sdk/gcloud/reference/beta/container/bare-metal)\n\nExamples creating a cluster \n\nMetalLB\n\n```\ngcloud container bare-metal clusters create user-cluster-1 \\\n --project=example-project-12345 \\\n --location=europe-west1 \\\n --admin-cluster-membership=projects/example-project-12345/locations/global/memberships/admin-cluster-1 \\\n --version=1.32.400-gke.68 \\\n --admin-users=sara@example.com \\\n --admin-users=amal@example.com \\\n --island-mode-service-address-cidr-blocks=10.96.0.0/20 \\\n --island-mode-pod-address-cidr-blocks=192.168.0.0/16 \\\n --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' \\\n --control-plane-node-configs='node-ip=10.200.0.10' \\\n --control-plane-node-configs='node-ip=10.200.0.11,labels=key2.1=value2.1' \\\n --control-plane-node-configs='node-ip=10.200.0.12,labels=key3.1=value3.1;key3.2=value3.2' \\\n --control-plane-node-labels=cp-node-pool-key=cp-node-pool-value \\\n --control-plane-node-taints=dedicated=experimental:PreferNoSchedule \\\n --control-plane-vip=172.16.20.61 \\\n --control-plane-load-balancer-port=443 \\\n --ingress-vip=10.251.134.80 \\\n --lvp-share-path=/mnt/localpv-share \\\n --lvp-share-storage-class=local-shared \\\n --lvp-node-mounts-config-path=/mnt/localpv-disk \\\n --lvp-node-mounts-config-storage-class=local-disks\n```\n\nOptionally, you can include the `--metal-lb-load-balancer-node-configs` flag\nif you need to run the load balancer on a dedicated pool of worker nodes.\nFor details see\n[MetalLB nodes](/kubernetes-engine/distributed-cloud/bare-metal/docs/installing/creating-clusters/create-user-cluster-api#metal_lb_nodes).\n\nManual load balancer\n\n```\ngcloud container bare-metal clusters create user-cluster-2 \\\n --project=example-project-12345 \\\n --location=europe-west1 \\\n --admin-cluster-membership=projects/example-project-12345/locations/global/memberships/admin-cluster-1 \\\n --version=1.32.400-gke.68 \\\n --admin-users=sara@example.com \\\n --admin-users=amal@example.com \\\n --island-mode-service-address-cidr-blocks=10.96.0.0/20 \\\n --island-mode-pod-address-cidr-blocks=192.168.0.0/16 \\\n --enable-manual-lb \\\n --control-plane-node-configs='node-ip=10.200.0.10' \\\n --control-plane-node-configs='node-ip=10.200.0.11,labels=key2.1=value2.1' \\\n --control-plane-node-configs='node-ip=10.200.0.12,labels=key3.1=value3.1;key3.2=value3.2' \\\n --control-plane-node-labels=cp-node-pool-key=cp-node-pool-value \\\n --control-plane-node-taints=dedicated=experimental:PreferNoSchedule \\\n --control-plane-vip=172.16.20.61 \\\n --control-plane-load-balancer-port=443 \\\n --ingress-vip=10.251.134.80 \\\n --lvp-share-path=/mnt/localpv-share \\\n --lvp-share-storage-class=local-shared \\\n --lvp-node-mounts-config-path=/mnt/localpv-disk \\\n --lvp-node-mounts-config-storage-class=local-disks\n```\n\nCreate a node pool\n\nAfter the cluster is created, you can use the\n`gcloud container bare-metal node-pools create` command to create a\nnode pool:\n\n```\ngcloud container bare-metal node-pools create default-pool \\\n --cluster=user-cluster-1 \\\n --project=example-project-12345 \\\n --location=us-west1 \\\n --node-configs='node-ip=10.200.0.10' \\\n --node-configs='node-ip=10.200.0.11,labels=key2.1=value2.1' \\\n --node-labels=node-pool-key=node-pool-value \\\n --node-taints=dedicated=experimental:PreferNoSchedule\n```\n\nFor descriptions of the flags, see\n[Create a node pool](/kubernetes-engine/distributed-cloud/bare-metal/docs/installing/creating-clusters/create-user-cluster-api#create_the_cluster_and_node_pools).\n\nWhat's next\n\n- [Create a user cluster](/kubernetes-engine/distributed-cloud/bare-metal/docs/installing/creating-clusters/create-user-cluster-api#create_a_user_cluster)\n- [The gcloud CLI reference](/sdk/gcloud/reference/beta/container/bare-metal)"]]