이 문서에서는 VM-호스트 어피니티를 사용하기 위해 Google Distributed Cloud 클러스터를 구성하는 방법의 예시를 보여줍니다.
VM-호스트 그룹 어피니티는 고가용성을 보장하기 위해 Google Distributed Cloud에서 제공하는 메커니즘 중 하나입니다. VM-호스트 그룹 어피니티를 사용하여 물리적 ESXi 호스트 그룹을 만듭니다. 그런 다음 VM 그룹을 호스트 그룹과 연결하도록 클러스터를 구성합니다.
예를 들어 하나의 노드 풀에서 모든 VM이 특정 호스트 그룹에서 실행되도록 구성할 수 있습니다. 또한 두 번째 노드 풀의 모든 VM이 다른 호스트 그룹에서 실행되도록 구성할 수 있습니다. 그런 다음 각 노드 풀을 장애 도메인으로 처리할 수 있습니다.
장애 도메인을 구분하기 위해 여러 노드 풀의 VM에 라벨을 추가할 수 있습니다.
vSphere 환경에서 두 개 이상의 호스트 DRS 그룹을 만듭니다. 이 연습에서는 각각 3개의 호스트가 있는 2개의 호스트 그룹이 적합합니다. 자세한 내용은 호스트 DRS 그룹 만들기를 참조하세요.
사용자 클러스터 만들기
이 섹션에서는 VM-호스트 그룹 어피니티를 사용하는 사용자 클러스터를 만드는 방법의 예를 제공합니다. 이 예시의 클러스터는 Controlplane V2를 사용합니다.
클러스터에는 고가용성 컨트롤 플레인이 포함되므로 3개의 컨트롤 플레인 노드가 있습니다. 컨트롤 플레인 노드 외에도 하나의 노드 풀과 두 번째 노드 풀에 각각 3개씩 6개의 워커 노드가 있습니다. 모든 노드에는 고정 IP 주소가 사용됩니다.
클러스터 컨트롤러는 worker-pool-1 노드 풀에 노드 3개가 있는 VM DRS 그룹을 만듭니다. 또한 컨트롤러는 worker-pool-1의 노드가 hostgroup-1에 있는 호스트에서 실행되도록 VM-호스트 어피니티 규칙을 만듭니다. worker-pool-1의 노드에는 failuredomain: "failuredomain-1" 라벨이 있습니다.
클러스터 컨트롤러는 worker-pool-2 노드 풀에 노드 3개가 있는 VM DRS 그룹을 만듭니다. 또한 컨트롤러는 worker-pool-2의 노드가 hostgroup-2에 있는 호스트에서 실행되도록 VM-호스트 어피니티 규칙을 만듭니다. worker-pool-2의 노드에는 failuredomain: "failuredomain-2" 라벨이 있습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-01(UTC)"],[],[],null,["This document gives an example of how to configure a Google Distributed Cloud cluster to\nuse\n[VM-Host affinity](https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.resmgmt.doc/GUID-2FB90EF5-7733-4095-8B66-F10D6C57B820.html).\n\nVM-Host Group affinity is one of the mechanisms that Google Distributed Cloud provides\nto ensure high availability. With VM-Host Group affinity, you create groups of\nphysical ESXi hosts. Then you configure your cluster to associate VM groups with\nhost groups.\n\nFor example, you could configure all VMs in one node pool to run on a particular\nhost group. And you could configure all VMs in a second node pool to run on a\ndifferent host group. You could then treat each node pool as a failure domain.\nTo differentiate the failure domains, you could add labels to the VMs in\nthe various node pools.\n\nUsing VM-Host Group affinity isn't supported on\n[advanced clusters](/kubernetes-engine/distributed-cloud/vmware/docs/how-to/user-cluster-configuration-file-latest#enable-advanced-cluster-field).\n\nBefore you begin\n\nFor this exercise, you need to have at least six ESXi hosts in your vSphere\nenvironment.\n\nCreate host groups\n\nCreate two or more host DRS groups in your vSphere environment. For this\nexercise, two host groups with three hosts each would be appropriate. For\ninstructions, see\n[Create a Host DRS Group](https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.resmgmt.doc/GUID-D89CEBB5-5C43-4FAC-83D1-E7CB576FF86D.html).\n\nCreate a user cluster\n\nThis section gives an example of how to create a user cluster that uses VM-Host\nGroup affinity. The cluster in this example uses\n[Controlplane V2](/kubernetes-engine/distributed-cloud/vmware/docs/how-to/user-cluster-configuration-file-latest#enablecontrolplanev2-field).\nThe cluster has a high-availability control plane, so there are three\ncontrol-plane nodes. In addition to the control-plane nodes, there are six\nworker nodes: three in one node pool and three in a second node pool. All nodes\nuse static IP addresses.\n\nStart by following the instructions in\n[Create a user cluster](/kubernetes-engine/distributed-cloud/vmware/docs/how-to/create-user-cluster).\n\nAs you fill in your user cluster configuration file:\n\n- Specify two node pools for worker nodes. For each node pool, set `replicas` to `3`, and provide the name of an existing host group.\n\nExample configuration file\n\nHere is an example of an IP block file and a portion of a user cluster\nconfiguration file.\n\nuser-ipblock.yaml\n\n```\nblocks:\n - netmask: 255.255.255.0\n gateway: 172.16.21.1\n ips:\n - ip: 172.16.21.2\n - ip: 172.16.21.3\n - ip: 172.16.21.4\n - ip: 172.16.21.5\n - ip: 172.16.21.6\n - ip: 172.16.21.7\n - ip: 172.16.21.8\n\n```\n\nuser-cluster-yaml\n\n```\napiVersion: v1\nkind: UserCluster\n...\nnetwork:\n hostConfig:\n dnsServers:\n - \"203.0.113.2\"\n - \"198.51.100.2\"\n ntpServers:\n - \"216.239.35.4\"\n ipMode:\n type: \"static\"\n ipBlockFilePath: \"user-ipblock.yaml\"\n controlPlaneIPBlock:\n netmask: \"255.255.255.0\"\n gateway: \"172.16.21.1\"\n ips:\n - ip: \"172.16.21.9\"\n hostname: \"cp-vm-1\"\n - ip: \"172.16.21.10\"\n hostname: \"cp-vm-2\"\n - ip: \"172.16.21.11\"\n hostname: \"cp-vm-3\"\nloadBalancer:\n vips:\n controlPlaneVIP: \"172.16.21.40\"\n ingressVIP: \"172.16.21.30\"\n kind: MetalLB\n metalLB:\n addressPools:\n - name: \"address-pool-1\"\n addresses:\n - \"172.16.21.30-172.16.21.39\"\n...\nenableControlplaneV2: true\nmasterNode:\n cpus: 4\n memoryMB: 8192\n replicas: 3\nnodePools:\n- name: \"worker-pool-1\"\n enableLoadBalancer: true\n replicas: 3\n vsphere:\n hostgroups:\n - \"hostgroup-1\"\n labels:\n failuredomain: \"failuredomain-1\"\n- name: \"worker-pool-2\"\n replicas: 3\n vsphere:\n hostgroups:\n - \"hostgroup-2\"\n labels:\n failuredomain: \"failuredomain-2\"\n...\n```\n\nThese are the important points to understand in the preceding example:\n\n- The static IP addresses for the worker nodes are specified in an IP block\n file. The IP block file has seven addresses even though there are only six\n worker nodes. The extra IP address is needed during cluster upgrade, update,\n and auto repair.\n\n- The static IP addresses for the three control-plane nodes are specified in the\n `network.controlPlaneIPBlock` section of the user cluster configuration file.\n There is no need for an extra IP address in this block.\n\n- The `masterNode.replicas` field is set to `3`, so there will be three\n control-plane nodes.\n\n- A cluster controller will create a VM DRS group that has the three nodes in\n the `worker-pool-1` node pool. A controller will also create a\n [VM-Host affinity rule](https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.resmgmt.doc/GUID-2FB90EF5-7733-4095-8B66-F10D6C57B820.html)\n that ensures nodes in `worker-pool-1` will run on hosts that are in\n `hostgroup-1`. The nodes in `worker-pool-1` have the label\n `failuredomain: \"failuredomain-1\"`\n\n- A cluster controller will create a VM DRS group that has the three nodes in\n the `worker-pool-2` node pool. A controller will also create a\n VM-Host affinity rule that ensures nodes in `worker-pool-2` will run on hosts\n that are in `hostgroup-2`. The nodes in `worker-pool-2` have the label\n `failuredomain: \"failuredomain-2\"`\n\nContinue creating your user cluster as described in\n[Create a user cluster](/kubernetes-engine/distributed-cloud/vmware/docs/how-to/create-user-cluster)."]]