Questa pagina fornisce esempi sull'utilizzo del comando gcloud container bare-metal clusters create per creare un cluster utente GKE su Bare Metal. Dopo aver creato il cluster utente, devi creare almeno un pool di nodi. Puoi utilizzare il comando gcloud container bare-metal node-pools create per creare un pool di nodi. La maggior parte delle impostazioni eseguite dai comandi corrisponde ai campi nel file di configurazione del cluster e del pool di nodi.
Per le descrizioni delle segnalazioni, consulta le seguenti risorse:
Facoltativamente, puoi includere il flag --metal-lb-load-balancer-node-configs se devi eseguire il bilanciatore del carico su un pool dedicato di nodi worker.
Per maggiori dettagli, consulta la pagina relativa ai nodi MetalLB.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2024-05-08 UTC."],[[["\u003cp\u003eThis page demonstrates the use of \u003ccode\u003egcloud container bare-metal clusters create\u003c/code\u003e to set up a Google Distributed Cloud user cluster.\u003c/p\u003e\n"],["\u003cp\u003eAfter creating the user cluster, you must utilize \u003ccode\u003egcloud container bare-metal node-pools create\u003c/code\u003e to establish at least one node pool.\u003c/p\u003e\n"],["\u003cp\u003eThe examples provided showcase cluster creation using MetalLB and manual load balancer configurations, each with distinct command structures.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egcloud\u003c/code\u003e commands include settings that map to the cluster and node pool configuration file, however, IP addresses and CIDR ranges in the example must be replaced.\u003c/p\u003e\n"],["\u003cp\u003eYou can utilize the \u003ccode\u003e--metal-lb-load-balancer-node-configs\u003c/code\u003e flag to run the load balancer on specific nodes, or \u003ccode\u003e--enable-manual-lb\u003c/code\u003e to enable a manual load balancer configuration.\u003c/p\u003e\n"]]],[],null,["# Examples using the gcloud CLI to create a user cluster\n\n\u003cbr /\u003e\n\nThis 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](/anthos/clusters/docs/bare-metal/1.16/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](/anthos/clusters/docs/bare-metal/1.16/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---------------------------\n\n### MetalLB\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.16.8 \\\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](/anthos/clusters/docs/bare-metal/1.16/installing/creating-clusters/create-user-cluster-api#metal_lb_nodes).\n\n### Manual 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.16.8 \\\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------------------\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](/anthos/clusters/docs/bare-metal/1.16/installing/creating-clusters/create-user-cluster-api#create_the_cluster_and_node_pools).\n\nWhat's next\n-----------\n\n- [Create a user cluster](/anthos/clusters/docs/bare-metal/1.16/installing/creating-clusters/create-user-cluster-api#create_a_user_cluster)\n- [The gcloud CLI reference](/sdk/gcloud/reference/beta/container/bare-metal)"]]