# bmctl configuration variables. Because this section is valid YAML but not a valid Kubernetes# resource, this section can only be included when using bmctl to# create the initial admin/hybrid cluster. Afterwards, when creating user clusters by directly# applying the cluster and node pool resources to the existing cluster, you must remove this# section.gcrKeyPath:bmctl-workspace/.sa-keys/my-gcp-project-anthos-baremetal-gcr.jsonsshPrivateKeyPath:/path/to/your/ssh_private_keygkeConnectAgentServiceAccountKeyPath:bmctl-workspace/.sa-keys/my-gcp-project-anthos-baremetal-connect.jsongkeConnectRegisterServiceAccountKeyPath:bmctl-workspace/.sa-keys/my-gcp-project-anthos-baremetal-register.jsoncloudOperationsServiceAccountKeyPath:bmctl-workspace/.sa-keys/my-gcp-project-anthos-baremetal-cloud-ops.json
向舰队注册集群。您在 bmctl create config 命令中指定的项目 ID 会自动添加到集群配置文件中的 gkeConnect.projectID 字段。此项目即为舰队宿主项目。
如果您使用自动 API 启用和服务账号创建功能创建了配置文件,则可以跳过此步骤。
如果您不使用自动 API 启用和服务账号创建功能创建配置文件,请在集群配置文件的相应 gkeConnectAgentServiceAccountKeyPath 和 gkeConnectRegisterServiceAccountKeyPath 字段中引用下载的服务账号 JSON 密钥。
更改配置以指定 hybrid 集群类型而不是 admin:
spec:# Cluster type. This can be:# 1) admin: to create an admin cluster. This can later be used to create user clusters.# 2) user: to create a user cluster. Requires an existing admin cluster.# 3) hybrid: to create a hybrid cluster that runs admin cluster components and user workloads.# 4) standalone: to create a cluster that manages itself, runs user workloads, but does not manage other clusters.type:hybrid
更改配置以指定多节点、高可用性的控制平面。您需要指定奇数个节点,以通过多数仲裁实现高可用性:
# Control plane configurationcontrolPlane:nodePoolSpec:nodes:# Control plane node pools. Typically, this is either a single machine# or 3 machines if using a high availability deployment.-address:10.200.0.4-address:10.200.0.5-address:10.200.0.6
指定集群节点的 pod 密度:
....# NodeConfig specifies the configuration that applies to all nodes in the cluster.nodeConfig:# podDensity specifies the pod density configuration.podDensity:# maxPodsPerNode specifies at most how many pods can be run on a single node.maxPodsPerNode:250....
对于混合集群,允许的 maxPodsPerNode 值为 32-250(HA 集群)和 64-250(非 HA 集群)。如果未指定 maxPodsPerNode,则默认值为 110。集群创建后,此值无法更新。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-04。"],[],[],null,["In Google Distributed Cloud, hybrid clusters perform the dual role of an admin\ncluster and a user cluster. They run workloads, and at the same time, manage\nother clusters, and themselves.\n\nHybrid clusters eliminate the need to run a separate admin cluster in\nresource-constrained scenarios, and can provide highly available (HA)\nreliability. In an HA hybrid cluster, if one node fails, then others will take\nits place.\n\nHybrid clusters are different from standalone clusters in that they can also\nmanage other clusters. Standalone clusters can't create or manage other\nclusters.\n\nWhen you create hybrid clusters, there is some tradeoff between flexibility and\nsecurity, however. Since hybrid clusters manage themselves, running workloads on\nthe same cluster increases the risk of security exposure to sensitive\nadministrative data, like SSH keys.\n\nYou create a hybrid cluster with a high availability (HA) control plane using\nthe `bmctl` command. The `bmctl` command can be run on a separate workstation or\non one of the hybrid cluster nodes.\n\nPrerequisites\n\n- Latest `bmctl` is downloaded (`gs://anthos-baremetal-release/bmctl/1.32.400-gke.68/linux-amd64/bmctl`) from Cloud Storage.\n- Workstation running `bmctl` has network connectivity to all nodes in the target hybrid cluster.\n- Workstation running `bmctl` has network connectivity to the control plane VIP of the target hybrid cluster.\n- SSH key used to create the hybrid cluster is available to root, or there is SUDO user access on all nodes in the target hybrid cluster.\n- Connect-register service account is configured for use with Connect.\n\nSee the [Google Distributed Cloud quickstart](/kubernetes-engine/distributed-cloud/bare-metal/docs/quickstart) for\nexpanded step-by-step instructions for creating a hybrid cluster.\n\nEnable SELinux\n\nIf you want to enable SELinux to secure your containers, you must make sure that\nSELinux is enabled in `Enforced` mode on all your host machines. Starting with\nGoogle Distributed Cloud release 1.9.0 or later, you can enable or disable SELinux\nbefore or after cluster creation or cluster upgrades. SELinux is enabled by\ndefault on Red Hat Enterprise Linux (RHEL). If SELinux is disabled on\nyour host machines or you aren't sure, see\n[Securing your containers using SELinux](/kubernetes-engine/distributed-cloud/bare-metal/docs/installing/configure-selinux)\nfor instructions on how to enable it.\n\nGoogle Distributed Cloud supports SELinux in only RHEL systems.\n\nLog into gcloud and create a cluster configuration file\n\n1. Log into the gcloud CLI as a user using `gcloud auth application-default login`:\n\n gcloud auth application-default login\n\n You need to have a Project Owner or Editor role to use the automatic API\n enablement and Service Account creation features, described in the following\n sections.\n\n You can also add the following IAM roles to the user:\n - Service Account Admin\n - Service Account Key Admin\n - Project IAM Admin\n - Compute Viewer\n - Service Usage Admin\n\n Alternatively, if you already have a service account with those roles, run: \n\n export GOOGLE_APPLICATION_CREDENTIALS=\u003cvar label=\"path of the JSON key file\" translate=\"no\"\u003eJSON_KEY_FILE\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eJSON_KEY_FILE\u003c/var\u003e with the path of your service\n account JSON key file.\n2. Get your Google Cloud project ID to use with cluster creation:\n\n export CLOUD_PROJECT_ID=$(gcloud config get-value project)\n\nCreate the cluster configuration file with `bmctl`\n\nAfter you've logged into the gcloud CLI and have your project set up,\nyou can create the cluster configuration file with the `bmctl` command.\n\nTo create a cluster configuration file:\n\n1. Run the following command creates the cluster configuration file, creates\n all needed service accounts, and enables all required APIs:\n\n bmctl create config -c \u003cvar label=\"name of the cluster to be created\" translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e\u003c/var\u003e --enable-apis \\\n --create-service-accounts --project-id=\u003cvar label=\"\" translate=\"no\"\u003eCLOUD_PROJECT_ID\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e: the name of the cluster you're creating.\n - \u003cvar translate=\"no\"\u003eCLOUD_PROJECT_ID\u003c/var\u003e: the ID of your Google Cloud project.\n\n By default, the configuration file is written to\n `bmctl-workspace/`\u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e`/`\u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e`.yaml`.\n\n If you've already enabled APIs and created service accounts, you can create\n configuration files without enabling APIs and creating service accounts. You\n also aren't required to use the `--project-id` flag. However, you'll need to\n specify credentials in your configuration file manually.\n\n For more information about command options, see\n [create config](/kubernetes-engine/distributed-cloud/bare-metal/docs/reference/bmctl#create_config).\n\nEdit the cluster configuration file\n\nNow that you have a cluster configuration file, edit it to make the following changes:\n\n1. Provide the SSH private key to access the hybrid cluster nodes:\n\n # bmctl configuration variables. Because this section is valid YAML but not a valid Kubernetes\n # resource, this section can only be included when using bmctl to\n # create the initial admin/hybrid cluster. Afterwards, when creating user clusters by directly\n # applying the cluster and node pool resources to the existing cluster, you must remove this\n # section.\n gcrKeyPath: bmctl-workspace/.sa-keys/my-gcp-project-anthos-baremetal-gcr.json\n sshPrivateKeyPath: /path/to/your/ssh_private_key\n gkeConnectAgentServiceAccountKeyPath: bmctl-workspace/.sa-keys/my-gcp-project-anthos-baremetal-connect.json\n gkeConnectRegisterServiceAccountKeyPath: bmctl-workspace/.sa-keys/my-gcp-project-anthos-baremetal-register.json\n cloudOperationsServiceAccountKeyPath: bmctl-workspace/.sa-keys/my-gcp-project-anthos-baremetal-cloud-ops.json\n\n2. Register your clusters to a\n [fleet](/kubernetes-engine/fleet-management/docs). The project ID that you specified\n in the `bmctl create config` command is automatically added to the\n `gkeConnect.projectID` field in the cluster configuration file. This project is\n referred to as the\n [fleet host project](/kubernetes-engine/fleet-management/docs/fleet-concepts#fleet-host-project).\n\n - If you created your configuration file, using the automatic API enablement and Service Account creation features, you can skip this step.\n - If you created the configuration file without using the automatic API enablement and Service Account creation features, reference the downloaded service account JSON keys in the corresponding `gkeConnectAgentServiceAccountKeyPath` and `gkeConnectRegisterServiceAccountKeyPath` fields of the cluster configuration file.\n3. Change the config to specify a cluster type of `hybrid` instead of `admin`:\n\n spec:\n # Cluster type. This can be:\n # 1) admin: to create an admin cluster. This can later be used to create user clusters.\n # 2) user: to create a user cluster. Requires an existing admin cluster.\n # 3) hybrid: to create a hybrid cluster that runs admin cluster components and user workloads.\n # 4) standalone: to create a cluster that manages itself, runs user workloads, but does not manage other clusters.\n type: hybrid\n\n4. Change the config to specify a multi-node, high availability control plane.\n You want to specify an odd number of nodes to be able to have a majority\n quorum for HA:\n\n # Control plane configuration\n controlPlane:\n nodePoolSpec:\n nodes:\n # Control plane node pools. Typically, this is either a single machine\n # or 3 machines if using a high availability deployment.\n - address: 10.200.0.4\n - address: 10.200.0.5\n - address: 10.200.0.6\n\n | **Note:** If you have an even number of nodes temporarily while adding or removing nodes for maintenance or replacement, your deployment maintains HA as long as you have enough quorum.\n5. Specify the pod density of cluster nodes:\n\n ....\n # NodeConfig specifies the configuration that applies to all nodes in the cluster.\n nodeConfig:\n # podDensity specifies the pod density configuration.\n podDensity:\n # maxPodsPerNode specifies at most how many pods can be run on a single node.\n maxPodsPerNode: 250\n ....\n\n For hybrid clusters, allowable values for `maxPodsPerNode` are `32-250` for\n HA clusters and `64-250` for non-HA clusters. The default value for\n `maxPodsPerNode` if unspecified is `110`. Once the cluster is created, this\n value cannot be updated.\n\n Pod density is also limited by your cluster's available IP resources. For details,\n see\n [Pod networking](/kubernetes-engine/distributed-cloud/bare-metal/docs/concepts/network-reqs#pod_networking).\n\nCreate the hybrid cluster with the cluster configuration\n\nUse the `bmctl` command to create the cluster: \n\n bmctl create cluster -c \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e\n\nReplace \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e with the name you used when you\ncreated the cluster configuration file the previous section.\n\nThe following shows an example of the command to create a cluster named\n`hybrid1`: \n\n bmctl create cluster -c hybrid1\n\nSample hybrid cluster configurations\n\nFor example hybrid cluster configurations, see\n[Hybrid clusters](/kubernetes-engine/distributed-cloud/bare-metal/docs/reference/config-samples#hybrid_clusters) in the\nCluster configuration samples."]]