mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
84 lines
3.0 KiB
Plaintext
84 lines
3.0 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * nodes/nodes/nodes-nodes-working.adoc
|
|
|
|
:_mod-docs-content-type: PROCEDURE
|
|
[id="nodes-control-plane-osp-migrating_{context}"]
|
|
= Migrating control plane nodes from one RHOSP host to another manually
|
|
|
|
[role="_abstract"]
|
|
If control plane machine sets are not enabled on your cluster, you can run a script that moves a control plane node from one {rh-openstack-first} node to another.
|
|
|
|
[NOTE]
|
|
====
|
|
Control plane machine sets are not enabled on clusters that run on user-provisioned infrastructure.
|
|
|
|
For information about control plane machine sets, see "Managing control plane machines with control plane machine sets".
|
|
====
|
|
|
|
.Prerequisites
|
|
|
|
* The environment variable `OS_CLOUD` refers to a `clouds` entry that has administrative credentials in a `clouds.yaml` file.
|
|
* The environment variable `KUBECONFIG` refers to a configuration that contains administrative {product-title} credentials.
|
|
|
|
.Procedure
|
|
|
|
* From a command line, run the following script:
|
|
+
|
|
[source,bash]
|
|
----
|
|
#!/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
|
|
----
|
|
+
|
|
If the script completes, the control plane machine is migrated to a new {rh-openstack} node. |