6.3.8. RHOSP ホストから別の RHOSP ホストへのコントロールプレーンノードの手動移行
クラスターでコントロールプレーンマシンセットが有効になっていない場合は、コントロールプレーンノードをある Red Hat OpenStack Platform (RHOSP) ノードから別のノードに移動するスクリプトを実行できます。
注記
コントロールプレーンマシンセットは、ユーザーがプロビジョニングしたインフラストラクチャー上で実行するクラスターでは有効になりません。
コントロールプレーンマシンセットの詳細は、「コントロールプレーンマシンセットを使用したコントロールプレーンマシンの管理」を参照してください。
前提条件
-
環境変数
OS_CLOUDは、clouds.yamlファイル内の管理者認証情報を含むcloudsエントリーを参照します。 -
環境変数
KUBECONFIGは、管理用 OpenShift Container Platform 認証情報を含む設定を参照します。
手順
コマンドラインから、次のスクリプトを実行します。
#!/usr/bin/env bash set -Eeuo pipefail if [ $# -lt 1 ]; then echo "Usage: '$0 node_name'" exit 64 fi # Check for admin OpenStack credentials openstack server list --all-projects >/dev/null || { >&2 echo "The script needs OpenStack admin credentials. Exiting"; exit 77; } # Check for admin OpenShift credentials oc adm top node >/dev/null || { >&2 echo "The script needs OpenShift admin credentials. Exiting"; exit 77; } set -x declare -r node_name="$1" declare server_id server_id="$(openstack server list --all-projects -f value -c ID -c Name | grep "$node_name" | cut -d' ' -f1)" readonly server_id # Drain the node oc adm cordon "$node_name" oc adm drain "$node_name" --delete-emptydir-data --ignore-daemonsets --force # Power off the server oc debug "node/${node_name}" -- chroot /host shutdown -h 1 # Verify the server is shut off until openstack server show "$server_id" -f value -c status | grep -q 'SHUTOFF'; do sleep 5; done # Migrate the node openstack server migrate --wait "$server_id" # Resize the VM openstack server resize confirm "$server_id" # Wait for the resize confirm to finish until openstack server show "$server_id" -f value -c status | grep -q 'SHUTOFF'; do sleep 5; done # Restart the VM openstack server start "$server_id" # Wait for the node to show up as Ready: until oc get node "$node_name" | grep -q "^${node_name}[[:space:]]\+Ready"; do sleep 5; done # Uncordon the node oc adm uncordon "$node_name" # Wait for cluster operators to stabilize until oc get co -o go-template='statuses: {{ range .items }}{{ range .status.conditions }}{{ if eq .type "Degraded" }}{{ if ne .status "False" }}DEGRADED{{ end }}{{ else if eq .type "Progressing"}}{{ if ne .status "False" }}PROGRESSING{{ end }}{{ else if eq .type "Available"}}{{ if ne .status "True" }}NOTAVAILABLE{{ end }}{{ end }}{{ end }}{{ end }}' | grep -qv '\(DEGRADED\|PROGRESSING\|NOTAVAILABLE\)'; do sleep 5; doneスクリプトが完了すると、コントロールプレーンマシンは新しい RHOSP ノードに移行されます。