Manage Node
1 Delete Node
- 1.1 列出要删除Node上Pod信息
oc adm manage-node devnode6.example.com --list-pods
- 1.2 将Node设置SchedulingDisabled
oc adm cordon devnode6.example.com
OR
#要将一个或多个节点标记为不可调度:
$ oc adm manage-node <node1> <node2> --schedulable = false
#要将当前不可调度的节点标记为可调度:
$ oc adm manage-node <node1> <node2> --schedulable
#或者,<node1> <node2>您可以使用该--selector=<node_selector>选项将所选节点标记为可调度或不可调度,而不是指定特定节点名称(例如)。
-
1.3 驱逐Node上的POD
- 清除logging fluentd pod
oc label node devnode6.example.com logging-infra-fluentd-
oc label node devnode7.example.com logging-infra-fluentd-
oc label node devnode8.example.com logging-infra-fluentd-
- 驱逐其它POD
oc adm drain devnode6.example.com
- 1.4 删除Node节点
oc delete node devnode6.example.com
2 Add Node
10.19.41.48
- 2.1 Reset Node hostname
login to master1(dev_OR_prd)
_NODE_='10.19.41.48'
_NODE_HOSTNAME_='prd-dms-node01.example.com'
ssh "${_NODE_}" "hostnamectl set-hostname ${_NODE_HOSTNAME_}"
ssh "${_NODE_}" "hostname"
- 2.2 修改master ansible hosts文件
cp /etc/ansible/hosts /etc/ansible/hosts.$(date +%R_%F)
vi /etc/ansible/hosts
# ADD
[OSEv3:children]
masters
nodes
new_nodes # Add this group
...
...
[new_nodes]
10.19.41.48 openshift_hostname=prd-dms-node01.example.com openshift_ip=10.19.41.48 openshift_node_labels="{'region': 'primary', 'dms': 'enable' ,'app': 'enable','logging-infra-fluentd': 'true'}"
- 2.3 修改/etc/hosts文件
# 修改master1 /etc/hosts文件
ansible prdmaster1.example.com -m lineinfile -a "dest=/etc/hosts line='10.19.41.48 prd-dms-node01.example.com' backup=yes"
# 同步到全部节点
ansible all -m copy -a 'src=/etc/hosts dest=/etc/hosts backup=yes'
# 验证新加节点解析
ansible all -m shell -a 'ping -c 1 prd-dms-node01.example.com'
- 2.4 运行ansible 添加节点
ansible-playbook \
-i /etc/ansible/hosts \
-e openshift_deployment_type=openshift-enterprise \
-e os_sdn_network_plugin_name='redhat/openshift-ovs-multitenant' \
-e openshift_docker_additional_registries='registry.example.com' \
-e oreg_url='registry.example.com/openshift3/ose-${component}:${version}' \
-e openshift_examples_modify_imagestreams=true \
-e openshift_portal_net='10.186.0.0/16' \
-e osm_cluster_network_cidr='10.192.0.0/14' \
-e osm_host_subnet_length=10 \
/usr/share/ansible/openshift-ansible/playbooks/openshift-node/scaleup.yml
- 2.5 修改ansible /etc/ansible/hosts
vi /etc/ansible/hosts
# 将[new_nodes]下的新增的节点移至 [nodes] 组下
[nodes]
# DMS nodes
prd-dms-node01.example.com openshift_hostname=prd-dms-node01.example.com openshift_ip=10.19.41.48 openshift_node_labels="{'region': 'primary', 'logging-infra-fluentd': 'true', 'dms': 'enable' ,'app': 'enable'}"
# 原[new_nodes]组下保持为空
[new_nodes]
# 同步/etc/ansible/hosts 到其它master节点
ansible masters -m copy -a 'src=/etc/ansible/hosts dest=/etc/ansible/hosts backup=yes'
- 2.6 修改DNS
# 去除网卡配置文件中的DNS行
ansible prd-dms-node01.example.com -m lineinfile -a 'dest=/etc/sysconfig/network-scripts/ifcfg-ens192 regexp='^DNS' state=absent backup=yes'
ansible prd-dms-node01.example.com -m service -a 'name=NetworkManager state=restarted enabled=yes'
# 同步DNS配置文件
ansible prd-dms-node01.example.com -m copy -a 'src=/etc/dnsmasq.d/hisense.conf dest=/etc/dnsmasq.d/hisense.conf'
ansible prd-dms-node01.example.com -m copy -a 'src=/etc/dnsmasq.d/origin-upstream-dns.conf dest=/etc/dnsmasq.d/origin-upstream-dns.conf'
# 如果该节点需要配置上外网的功能, 运行以下命令.
ansible prd-dms-node01.example.com -m copy -a 'src=/scripts/dnsmasq/gotointernet.conf dest=/etc/dnsmasq.d/gotointernet.conf'
# 重启节点的dns服务
ansible prd-dms-node01.example.com -m service -a 'name=dnsmasq state=restarted enabled=yes'
ansible prd-dms-node01.example.com -m service -a 'name=atomic-openshift-node state=restarted enabled=yes'
# 检测DNS解析
ansible prd-dms-node01.example.com -m shell -a 'nslookup docker-registry.default.svc'
ansible prd-dms-node01.example.com -m shell -a 'nslookup ecp.example.com'
网友评论