diff --git a/installing/installing_vsphere/post-install-vsphere-zones-regions-configuration.adoc b/installing/installing_vsphere/post-install-vsphere-zones-regions-configuration.adoc index 5ac6f67626..0a38a216eb 100644 --- a/installing/installing_vsphere/post-install-vsphere-zones-regions-configuration.adoc +++ b/installing/installing_vsphere/post-install-vsphere-zones-regions-configuration.adoc @@ -50,3 +50,9 @@ include::modules/references-regions-zones-infrastructure-vsphere.adoc[leveloffse [role="_additional-resources"] .Additional resources * xref:../../installing/installing_vsphere/post-install-vsphere-zones-regions-configuration.adoc#specifying-regions-zones-infrastructure-vsphere_post-install-vsphere-zones-regions-configuration[Specifying multiple regions and zones for your cluster on vSphere] + +include::modules/specifying-host-groups-vsphere.adoc[leveloffset=+1] + +[role="_additional-resources"] +.Additional resources +* xref:../../nodes/clusters/nodes-cluster-enabling-features.adoc#nodes-cluster-enabling[Enabling features using feature gates] \ No newline at end of file diff --git a/modules/specifying-host-groups-vsphere.adoc b/modules/specifying-host-groups-vsphere.adoc new file mode 100644 index 0000000000..3e1c2cc4ae --- /dev/null +++ b/modules/specifying-host-groups-vsphere.adoc @@ -0,0 +1,233 @@ +// Module included in the following assemblies: +// installing/installing_vsphere/post-install-vsphere-zones-regions-configuration.adoc + +:_mod-docs-content-type: PROCEDURE +[id="specifying-host-groups-vsphere_{context}"] += Specifying multiple host groups for your cluster on vSphere + +You can configure the `infrastructures.config.openshift.io` configuration resource to specify multiple host groups for your {product-title} cluster that runs on a {vmw-first} instance. This is necessary if your {vmw-short} instance is in a stretched cluster configuration, with your ESXi hosts and storage distributed across multiple physical data centers. Use this procedure if you did not already configure host groups for your {product-title} cluster at installation, or if you need to update your {product-title} cluster with additional host groups. + +:FeatureName: OpenShift zones support for vSphere host groups +include::snippets/technology-preview.adoc[] + +.Prerequisites + +* ESXi hosts are grouped into host groups, which are linked via VM-host affinity rules to corresponding virtual machine (VM) groups. See the following example `govc` commands for details: ++ +[source,terminal] +---- +# This example shows the correct configuration for a cluster with two host groups: + +# Create host groups: +govc cluster.group.create -name -host +govc cluster.group.create -name -host + +# Create VM groups: +govc cluster.group.create -name -vm +govc cluster.group.create -name -vm + +# Create VM-host affinity rules: +govc cluster.rule.create -name -enable -vm-host -vm-group -host-affine-group +govc cluster.rule.create -name -enable -vm-host -vm-group -host-affine-group + +# Add ESXi hosts to host groups: +govc cluster.group.change -name +govc cluster.group.change -name +---- +* `openshift-region` and `openshift-zone` tag categories are created on the vCenter server. +* Compute clusters have tags from the `openshift-region` tag category. +* ESXi hosts within host groups have tags from the `openshift-zone` tag category. +* `Host.Inventory.EditCluster` privilege is granted on the {vmw-short} vCenter cluster object. +* `TechPreviewNoUpgrade` feature set is enabled. For more information, "see Enabling features using feature gates". + +.Procedure + +. Edit the infrastructure settings of your {product-title} cluster. + +.. To copy your existing infrastructure settings to a file, run the following command: ++ +[source,terminal] +---- +$ oc get infrastructures.config.openshift.io cluster -o yaml > .yaml +---- ++ +.. Edit your infrastructure file to include a failure domain for each host group in your {vmw-short} cluster. Refer to the following YAML file for an example of this configuration. Ensure you replace any values wrapped in angle brackets (`< >`) with your values: ++ +[source,yaml] +---- +apiVersion: config.openshift.io/v1 +kind: Infrastructure +metadata: + name: cluster +spec: + cloudConfig: + key: config + name: cloud-provider-config + platformSpec: + type: VSphere + vsphere: + apiServerInternalIPs: + - + failureDomains: + - name: + region: + server: + zoneAffinity: + type: HostGroup + hostGroup: + vmGroup: + hostGroup: + vmHostRule: + regionAffinity: + type: ComputeCluster + topology: + computeCluster: //host/ + datacenter: + datastore: //datastore/ + networks: + - VM Network + resourcePool: //host//Resources + template: //vm/ + zone: + - name: + region: + server: + zoneAffinity: + type: HostGroup + hostGroup: + vmGroup: + hostGroup: + vmHostRule: + regionAffinity: + type: ComputeCluster + topology: + computeCluster: //host/ + datacenter: + datastore: //datastore/ + networks: + - VM Network + resourcePool: //host//Resources + template: //vm/ + zone: +# ... +---- ++ +.. To update your cluster with these changes, run the following command: ++ +[source,terminal] +---- +$ oc replace -f .yaml +---- + +. Update your `ControlPlaneMachineSet` custom resource (CR) with the new failure domains by completing the following steps: ++ +.. Edit the `ControlPlaneMachineSet` CR by running the following command: ++ +[source,terminal] +---- +$ oc edit controlplanemachinesets.machine.openshift.io -n openshift-machine-api cluster +---- ++ +.. Edit the `failureDomains` parameter as shown in the following example: ++ +[source,yaml] +---- +spec: + replicas: 3 + selector: + matchLabels: + machine.openshift.io/cluster-api-cluster: jdoe3-whb8l + machine.openshift.io/cluster-api-machine-role: master + machine.openshift.io/cluster-api-machine-type: master + state: Active + strategy: + type: RollingUpdate + template: + machineType: machines_v1beta1_machine_openshift_io + machines_v1beta1_machine_openshift_io: + failureDomains: + platform: VSphere + vsphere: + - name: + - name: +# ... +---- ++ +.. Verify that your control plane nodes have finished updating before proceeding further. To do this, run the following command: ++ +[source,terminal] +---- +$ oc get controlplanemachinesets.machine.openshift.io -n openshift-machine-api +---- + +. Create new `MachineSet` CRs for your failure domains. ++ +.. To retrieve the configuration of an existing `MachineSet` CR for use as a template, run the following command: ++ +[source,terminal] +---- +$ oc get machinesets.machine.openshift.io -n openshift-machine-api -o yaml > machineset-.yaml +---- ++ +.. Copy the template as needed to create `MachineSet` CR files for each failure domain that you defined in your infrastructure file. Refer to the following example: ++ +[source,yaml] +---- +apiVersion: machine.openshift.io/v1beta1 +kind: MachineSet +metadata: + labels: + machine.openshift.io/cluster-api-cluster: + name: + namespace: openshift-machine-api +spec: + replicas: 0 + selector: + matchLabels: + machine.openshift.io/cluster-api-cluster: + machine.openshift.io/cluster-api-machineset: + template: + metadata: + labels: + machine.openshift.io/cluster-api-cluster: + machine.openshift.io/cluster-api-machine-role: worker + machine.openshift.io/cluster-api-machine-type: worker + machine.openshift.io/cluster-api-machineset: + spec: + lifecycleHooks: {} + metadata: {} + providerSpec: + value: + apiVersion: machine.openshift.io/v1beta1 + credentialsSecret: + name: vsphere-cloud-credentials + diskGiB: + kind: VSphereMachineProviderSpec + memoryMiB: + metadata: + creationTimestamp: null + network: + devices: + - networkName: VM Network + numCPUs: + numCoresPerSocket: + snapshot: "" + template: + userDataSecret: + name: worker-user-data + workspace: + datacenter: + datastore: //datastore/ + folder: //vm/ + resourcePool: //host//Resources + server: + vmGroup: +# ... +---- ++ +.. For each `MachineSet` CR file, run the following command: ++ +[source,terminal] +---- +$ oc create -f .yaml +----