openshift 增加节点:
前提是有一个已经运行的openshift的集群。在此集群上添加一个node。
如何建立openshift集群,参见https://blog.csdn.net/xiaofeng_yan/article/details/90174543
步骤一:
新建立一个虚拟机,本文的虚拟机的IP是
10.2.3.21,hostname 为node3
步骤二:
在master1的/etc/ansible/hosts增加如下字段:
[OSEv3:children]
new_nodes #增加此字段
#增加下两行
[new_nodes]
node3 openshift_node_labels="{'region': 'primary', 'zone': 'east'}" openshift_node_group_name='node-config-compute'
保存文件
步骤三:
将master1的公钥加入到node3
pc# ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]
步骤四:
修改所有host的/etc/hosts文件,具体步骤
1 在master1上修改/etc/hosts文件,内容如下:
10.2.3.12 master1
10.2.3.13 master2
10.2.3.14 master3
10.2.3.15 node1
10.2.3.16 node2
10.2.3.17 nfs
10.2.3.18 lb
#增加的node3的dns解析
10.2.3.21 node3
2 将在master1修改的host3放到集群内所有的host上
for host in master1 master2 master3 node1 node2 node3 lb nfs;do scp /etc/hosts ${host}/etc;done
步骤五:
重启每个host的dnsmq
pc# ansible all -m shell -a "systemctl restart dnsmasq"
此步很重要,不执行此步会导致如下错误:
TASK [Approve node certificates when bootstrapping] ************************************
FAILED - RETRYING: Approve node certificates when bootstrapping (30 retries left).
FAILED - RETRYING: Approve node certificates when bootstrapping (29 retries left).
步骤六:
提前下载好依赖的rpm包和docker镜像,具体和镜像参见:
https://blog.csdn.net/xiaofeng_yan/article/details/90174543
步骤七:执行ansible playbook,在新增节点上部署openshift程序
ansible-playbook openshift-ansible/playbooks/openshift-node/scaleup.yml
步骤八:验证新增节点已添加成功
1 pc# oc get nodes
NAME STATUS ROLES AGE VERSION
master1 Ready infra,master 3d v1.11.0+d4cacc0
master2 Ready infra,master 3d v1.11.0+d4cacc0
master3 Ready infra,master 3d v1.11.0+d4cacc0
node1 Ready compute 3d v1.11.0+d4cacc0
node2 Ready compute 3d v1.11.0+d4cacc0
node3 Ready compute 1h v1.11.0+d4cacc0
2 pc# oc get --raw /api/v1/nodes/node3/proxy/healthz
ok