kolla ansible添加删除主控计算节点

1.添加节点


1.添加controllers


bootstrap-servers command用于准备即将加入系统的新节点。他会添加新节点的entry到/etc/hosts,并且一些所有controller节点都需要的服务比如RabbitMQ,如果使用–limit选项,确保包含所有的controller节点,比如 --limit control。
kolla-ansible -i <inventory> bootstrap-servers [--limit <limit>]

拉取镜像,–limit参数可仅仅包含新节点
kolla-ansible -i <inventory> pull [--limit <limit>]

部署容器到新节点,如果使用–limit选项,全包包含所有的controller节点–limit control。
kolla-ansible -i <inventory> deploy [--limit <limit>]

到此新的管理节点及部署完毕。建议进行相应的测试以确保新管理节点的功能性是否正常。
部分资源可能并不会自动的平衡到新的管理节点上。可以手动进行再平衡部分负载到新的节点上。对于如何平衡的具体操作可参照移除管理节点中的操作进行。


2.添加计算节点

使用bootstrap-servers command进行新节点的准备工作。
kolla-ansible -i <inventory> bootstrap-servers [--limit <limit>]

镜像拉取
kolla-ansible -i <inventory> pull [--limit <limit>]

部署容器到新节点
kolla-ansible -i <inventory> deploy [--limit <limit>]

建议进行相应的测试进行功能性的检测。
实例并不会自动的平衡到该新节点,可手动热迁移实例到新节点上。
openstack server migrate <server> --live-migration --host <target-host> --os-compute-api-version 2.30

通常可使用Watcher工具来自动执行。

2.移除节点

1.移除controller

移除controller或其他节点时,需要考虑集群现在是否有足够的节点。比如集群有3节点的controller,仅仅只能移除一个controller。同时需要考虑在冗余层面的影响。
在从集群移除controller节点之前,建议先对其上的资源进行迁移。比如由Neutron DHCP agent提供的网络服务以及由Neutron L3 agent提供的路由服务。其他需要的操作根据你的实际运行环境和配置。
对于即将移除的节点,查找该节点上的Neutron routers并且移动他们。并禁用L3 agent。
L3 agent

 

l3_id=$(openstack network agent list --host <host> --agent-type l3 -f value -c ID)
target_l3_id=$(openstack network agent list --host <target host> --agent-type l3 -f value -c ID)
openstack router list --agent $l3_id -f value -c ID | while read router;do
openstack network agent remove router $l3_id $router --l3
openstack network agent add router $ $target_l3_id $router --l3
done
openstack network agent set $l3_id --disable
 
DHCP agents
 
dhcp_id=$(openstack network agent list --host <host> --agent-type dhcp -f value -c ID)
target_dhcp_id=$(openstack network agent list --host <target host> --agent-type dhcp -f value -c ID)
openstack network list --agent $dhcp_id -f value -c ID | while read network;do
openstack network agent remove network $dhcp_id $network --dhcp
openstack network agent add network $target_dhcp_id $network --dhcp
done



停止即将停止的节点上的服务
kolla-ansible -i <inventory> stop --yes-i-really-really-mean-it --limit <limit>

从ansible inventory中移除hosts。
重新配置剩下的controllers来更新集群的节点关系,比如mariadb、rabbitmq。使用适当的限制,比如–limit control。
kolla-ansible -i <inventory> deploy [--limit <limit>]

进行测试验证操作的正确性。
对每个节点清理服务:

openstack network agent list --host <host> -f value -c ID | while read id;do
openstack network agent delete $id
done
 
openstack compute service list --os-compute-api-version 2.53 --host <host> -f value -c ID | while read id;do
openstack compute service delete --os-compute-api-version 2.53 $id
done


2.移除计算节点


考虑负载分担到剩余节点是否导致过载。
移除计算节点之前,需要对实例进行迁移或者删除。
对于需要移除的节点,禁用compute服务确保不会有新的实例调度到该节点之上。
openstack compute service set <host> nova-compute --disable

如果可以,迁移实例到其他的节点
openstack server list --host <host> -f value -c ID | while read server;do
openstack server migrate --live-migration $server
done

确认是否迁移成功。
停止即将移除节点上的所有服务。
kolla-ansible -i <inventory> stop --yes-i-really-really-mean-it [--limit <limit>]

从ansible inventory中移除删除的主机
测试集群中剩余的主机操作正常。
对于每一个节点,清理其服务:

openstack network agent list --host <host> -f value -c ID|while read id;do
openstack network agent delete $id
done
 
openstack compute service list --os-compute-api-version 2.53 --host <host> -f value -c ID |while read id;do
openstack compute service delete --os-compute-api-version 2.53 $id
done
posted @ 2024-03-07 14:02  暗痛  阅读(25)  评论(0编辑  收藏  举报