This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.第4章 マシンセットの変更
ラベルの追加、インスタンスタイプの変更、ブロックストレージの変更など、マシンセットに変更を加えることができます。
Red Hat Virtualization (RHV) では、マシンセットを変更して新規ノードを別のストレージドメインにプロビジョニングすることもできます。
他の変更なしにマシンセットをスケーリングする必要がある場合は、マシンセットの手動によるスケーリング を参照してください。
4.1. CLI を使用したマシンセットの変更 リンクのコピーリンクがクリップボードにコピーされました!
マシンセットを変更する場合、変更は更新された MachineSet
カスタムリソース(CR)を保存した後に作成されるマシンにのみ適用されます。この変更は既存のマシンには影響しません。コンピュートマシンセットをスケーリングすることで、既存のマシンを、更新された設定を反映した新しいマシンに置き換えることができます。
他の変更を加えずに、マシンセットをスケーリングする必要がある場合、マシンを削除する必要はありません。
デフォルトで、OpenShift Container Platform ルーター Pod はワーカーにデプロイされます。ルーターは Web コンソールなどの一部のクラスターリソースにアクセスすることが必要であるため、 ルーター Pod をまず再配置しない限り、ワーカーのマシンセットを 0
にスケーリングできません。
前提条件
- OpenShift Container Platform クラスターは、Machine API を使用する。
-
OpenShift CLI (
oc
) を使用して、管理者としてクラスターにログインしている。
手順
マシンセットを編集します。
oc edit machineset <machine_set_name> -n openshift-machine-api
$ oc edit machineset <machine_set_name> -n openshift-machine-api
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 変更を適用するためにマシンセットをスケーリングする際に必要になるため、
spec.replicas
フィールドの値を書き留めます。Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- この手順例では、
replicas
値が2
のコンピュートマシンセットを示しています。
- 必要な設定オプションを使用してコンピュートマシンセット CR を更新し、変更を保存します。
次のコマンドを実行して、更新されたコンピュートマシンセットによって管理されているマシンをリスト表示します。
oc get -n openshift-machine-api machines -l machine.openshift.io/cluster-api-machineset=<machine_set_name>
$ oc get -n openshift-machine-api machines -l machine.openshift.io/cluster-api-machineset=<machine_set_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
NAME PHASE TYPE REGION ZONE AGE <machine_name_original_1> Running m6i.xlarge us-west-1 us-west-1a 4h <machine_name_original_2> Running m6i.xlarge us-west-1 us-west-1a 4h
NAME PHASE TYPE REGION ZONE AGE <machine_name_original_1> Running m6i.xlarge us-west-1 us-west-1a 4h <machine_name_original_2> Running m6i.xlarge us-west-1 us-west-1a 4h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 次のコマンドを実行して、更新されたコンピュートマシンセットで管理されるマシンごとに
delete
アノテーションを設定します。oc annotate machine/<machine_name_original_1> \ -n openshift-machine-api \ machine.openshift.io/delete-machine="true"
$ oc annotate machine/<machine_name_original_1> \ -n openshift-machine-api \ machine.openshift.io/delete-machine="true"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 次のコマンドを実行して、コンピュートマシンセットをレプリカ数の 2 倍にスケーリングします。
oc scale --replicas=4 \ machineset <machine_set_name> \ -n openshift-machine-api
$ oc scale --replicas=4 \
1 machineset <machine_set_name> \ -n openshift-machine-api
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- 元の例の値
2
は 2 倍の4
になります。
次のコマンドを実行して、更新されたコンピュートマシンセットによって管理されているマシンをリスト表示します。
oc get -n openshift-machine-api machines -l machine.openshift.io/cluster-api-machineset=<machine_set_name>
$ oc get -n openshift-machine-api machines -l machine.openshift.io/cluster-api-machineset=<machine_set_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
NAME PHASE TYPE REGION ZONE AGE <machine_name_original_1> Running m6i.xlarge us-west-1 us-west-1a 4h <machine_name_original_2> Running m6i.xlarge us-west-1 us-west-1a 4h <machine_name_updated_1> Provisioned m6i.xlarge us-west-1 us-west-1a 55s <machine_name_updated_2> Provisioning m6i.xlarge us-west-1 us-west-1a 55s
NAME PHASE TYPE REGION ZONE AGE <machine_name_original_1> Running m6i.xlarge us-west-1 us-west-1a 4h <machine_name_original_2> Running m6i.xlarge us-west-1 us-west-1a 4h <machine_name_updated_1> Provisioned m6i.xlarge us-west-1 us-west-1a 55s <machine_name_updated_2> Provisioning m6i.xlarge us-west-1 us-west-1a 55s
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 新しいマシンが
Running
フェーズにある場合、コンピュートマシンセットを元のレプリカ数にスケーリングできます。次のコマンドを実行して、コンピュートマシンセットのレプリカ数を元の数にスケーリングします。
oc scale --replicas=2 \ machineset <machine_set_name> \ -n openshift-machine-api
$ oc scale --replicas=2 \
1 machineset <machine_set_name> \ -n openshift-machine-api
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- 元の例の値は
2
です。
検証
設定が更新されていないコンピュートマシンが削除されたことを確認するには、次のコマンドを実行して、更新されたコンピュートマシンセットによって管理されているマシンをリスト表示します。
oc get -n openshift-machine-api machines -l machine.openshift.io/cluster-api-machineset=<machine_set_name>
$ oc get -n openshift-machine-api machines -l machine.openshift.io/cluster-api-machineset=<machine_set_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 削除中の出力例
NAME PHASE TYPE REGION ZONE AGE <machine_name_original_1> Deleting m6i.xlarge us-west-1 us-west-1a 4h <machine_name_original_2> Deleting m6i.xlarge us-west-1 us-west-1a 4h <machine_name_updated_1> Running m6i.xlarge us-west-1 us-west-1a 5m41s <machine_name_updated_2> Running m6i.xlarge us-west-1 us-west-1a 5m41s
NAME PHASE TYPE REGION ZONE AGE <machine_name_original_1> Deleting m6i.xlarge us-west-1 us-west-1a 4h <machine_name_original_2> Deleting m6i.xlarge us-west-1 us-west-1a 4h <machine_name_updated_1> Running m6i.xlarge us-west-1 us-west-1a 5m41s <machine_name_updated_2> Running m6i.xlarge us-west-1 us-west-1a 5m41s
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 削除完了時の出力例
NAME PHASE TYPE REGION ZONE AGE <machine_name_updated_1> Running m6i.xlarge us-west-1 us-west-1a 6m30s <machine_name_updated_2> Running m6i.xlarge us-west-1 us-west-1a 6m30s
NAME PHASE TYPE REGION ZONE AGE <machine_name_updated_1> Running m6i.xlarge us-west-1 us-west-1a 6m30s <machine_name_updated_2> Running m6i.xlarge us-west-1 us-west-1a 6m30s
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 更新されたマシンセットによって作成されたマシンの設定が正しいことを確認するには、次のコマンドを実行して、新しいマシンの 1 つで CR の関連フィールドを調べます。
oc describe machine <machine_name_updated_1> -n openshift-machine-api
$ oc describe machine <machine_name_updated_1> -n openshift-machine-api
Copy to Clipboard Copied! Toggle word wrap Toggle overflow