10.4. vSphere 上のクラスターに複数のホストグループを指定する
infrastructures.config.openshift.io 設定リソースを設定して、VMware vSphere インスタンス上で実行される OpenShift Container Platform クラスターに複数のホストグループを指定できます。これは、vSphere インスタンスがストレッチクラスター設定になっており、ESXi ホストとストレージが複数の物理データセンターに分散されている場合に必要です。インストール時に OpenShift Container Platform クラスターのホストグループをまだ設定していない場合、または追加のホストグループを使用して OpenShift Container Platform クラスターを更新する必要がある場合は、この手順を使用します。
vSphere ホストグループに対する OpenShift ゾーンのサポートは、テクノロジープレビュー機能です。テクノロジープレビュー機能は、Red Hat 製品のサービスレベルアグリーメント (SLA) の対象外であり、機能的に完全ではないことがあります。Red Hat は、実稼働環境でこれらを使用することを推奨していません。テクノロジープレビュー機能は、最新の製品機能をいち早く提供して、開発段階で機能のテストを行い、フィードバックを提供していただくことを目的としています。
Red Hat のテクノロジープレビュー機能のサポート範囲に関する詳細は、以下のリンクを参照してください。
前提条件
ESXi ホストはホストグループにグループ化され、仮想マシンホストアフィニティールールを介して対応する仮想マシン (VM) グループにリンクされている。詳細は、次の
govcコマンドの例を参照してください。# This example shows the correct configuration for a cluster with two host groups: # Create host groups: govc cluster.group.create -name <host_group_1> -host govc cluster.group.create -name <host_group_2> -host # Create VM groups: govc cluster.group.create -name <vm_group_1> -vm govc cluster.group.create -name <vm_group_2> -vm # Create VM-host affinity rules: govc cluster.rule.create -name <rule_1> -enable -vm-host -vm-group <vm_group_1> -host-affine-group <host_group_1> govc cluster.rule.create -name <rule_2> -enable -vm-host -vm-group <vm_group_2> -host-affine-group <host_group_2> # Add ESXi hosts to host groups: govc cluster.group.change -name <host_group_1> <esxi_host_1_ip> govc cluster.group.change -name <host_group_2> <esxi_host_2_ip>-
openshift-regionおよびopenshift-zoneタグカテゴリーが vCenter サーバー上に作成されている。 -
コンピュートクラスターに
openshift-regionタグカテゴリーのタグがある。 -
ホストグループ内の ESXi ホストに
openshift-zoneタグカテゴリーのタグがある。 -
vSphere vCenter クラスターオブジェクトに
Host.Inventory.EditCluster特権が付与されている。 -
TechPreviewNoUpgrade機能セットが有効化されている。詳細は、「フィーチャーゲートを使用した機能の有効化」を参照してください。
手順
OpenShift Container Platform クラスターのインフラストラクチャー設定を編集します。
既存のインフラストラクチャー設定をファイルにコピーするには、次のコマンドを実行します。
$ oc get infrastructures.config.openshift.io cluster -o yaml > <name_of_infrastructure_file>.yamlインフラストラクチャーファイルを編集して、vSphere クラスター内の各ホストグループの障害ドメインを含めます。この設定の例は、次の YAML ファイルを参照してください。山括弧 (
< >) で囲まれた値は、必ず実際の値に置き換えてください。apiVersion: config.openshift.io/v1 kind: Infrastructure metadata: name: cluster spec: cloudConfig: key: config name: cloud-provider-config platformSpec: type: VSphere vsphere: apiServerInternalIPs: - <internal_ip_of_api_server> failureDomains: - name: <unique_name_for_failure_domain_1> region: <cluster_1_region_tag> server: <vcenter_server_ip_address> zoneAffinity: type: HostGroup hostGroup: vmGroup: <name_of_vm_group_1> hostGroup: <name_of_host_group_1> vmHostRule: <name_of_vm_host_affinity_rule_1> regionAffinity: type: ComputeCluster topology: computeCluster: /<data_center_1>/host/<cluster_1> datacenter: <data_center_1> datastore: /<data_center_1>/datastore/<datastore_1> networks: - VM Network resourcePool: /<data_center_1>/host/<cluster_1>/Resources template: /<data_center_1>/vm/<vm_template> zone: <host_group_1_tag> - name: <unique_name_for_failure_domain_2> region: <cluster_1_region_tag> server: <vcenter_server_ip_address> zoneAffinity: type: HostGroup hostGroup: vmGroup: <name_of_vm_group_2> hostGroup: <name_of_host_group_2> vmHostRule: <name_of_vm_host_affinity_rule_2> regionAffinity: type: ComputeCluster topology: computeCluster: /<data_center_1>/host/<cluster_1> datacenter: <data_center_1> datastore: /<data_center_1>/datastore/<datastore_1> networks: - VM Network resourcePool: /<data_center_1>/host/<cluster_1>/Resources template: /<data_center_1>/vm/<vm_template> zone: <host_group_2_tag> # ...これらの変更をクラスターに反映するには、次のコマンドを実行します。
$ oc replace -f <name_of_infrastructure_file>.yaml
次の手順を実行して、
ControlPlaneMachineSetカスタムリソース (CR) を新しい障害ドメインで更新します。次のコマンドを実行して、
ControlPlaneMachineSetCR を編集します。$ oc edit controlplanemachinesets.machine.openshift.io -n openshift-machine-api cluster次の例に示すように、
failureDomainsパラメーターを編集します。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: <failure_domain_1_name> - name: <failure_domain_2_name> # ...次に進む前に、コントロールプレーンノードの更新が完了していることを確認してください。これを実行するには、以下のコマンドを実行します。
$ oc get controlplanemachinesets.machine.openshift.io -n openshift-machine-api
障害ドメイン用に新しい
MachineSetCR を作成します。テンプレートとして使用するために既存の
MachineSetCR の設定を取得するには、次のコマンドを実行します。$ oc get machinesets.machine.openshift.io -n openshift-machine-api <existing_machine_set> -o yaml > machineset-<failure_domain_name>.yaml必要に応じてテンプレートをコピーし、インフラストラクチャーファイルで定義した各障害ドメインの
MachineSetCR ファイルを作成します。次の例を参照してください。apiVersion: machine.openshift.io/v1beta1 kind: MachineSet metadata: labels: machine.openshift.io/cluster-api-cluster: <infrastructure_id> name: <machineset_name> namespace: openshift-machine-api spec: replicas: 0 selector: matchLabels: machine.openshift.io/cluster-api-cluster: <infrastructure_id> machine.openshift.io/cluster-api-machineset: <machineset_name> template: metadata: labels: machine.openshift.io/cluster-api-cluster: <infrastructure_id> machine.openshift.io/cluster-api-machine-role: worker machine.openshift.io/cluster-api-machine-type: worker machine.openshift.io/cluster-api-machineset: <machineset_name> spec: lifecycleHooks: {} metadata: {} providerSpec: value: apiVersion: machine.openshift.io/v1beta1 credentialsSecret: name: vsphere-cloud-credentials diskGiB: <disk_GiB> kind: VSphereMachineProviderSpec memoryMiB: <memory_in_MiB> metadata: creationTimestamp: null network: devices: - networkName: VM Network numCPUs: <number_of_cpus> numCoresPerSocket: <number_of_cores_per_socket> snapshot: "" template: <template_name> userDataSecret: name: worker-user-data workspace: datacenter: <data_center_1> datastore: /<data_center_1>/datastore/<datastore_1> folder: /<data_center_1>/vm/<folder> resourcePool: /<data_center_1>/host/<cluster_1>/Resources server: <server_ip_address> vmGroup: <name_of_vm_group_1> # ...各
MachineSetCR ファイルに対して、次のコマンドを実行します。$ oc create -f <name_of_machine_set_file>.yaml