您的位置:首页 > Web前端 > Node.js

openshift/origin学习记录(13)——集群节点扩容(Master/node/etcd)

2017-10-26 12:30 791 查看
集群搭建成功之后,可以对集群进行扩容,包括对Master、Node、Etcd等的扩容,添加新的节点。

官方文档链接如下:https://docs.openshift.org/latest/install_config/adding_hosts_to_existing_cluster.html

这里在 openshift/origin学习记录(0)——Ansible安装多节点openshift集群 搭建的集群基础上进行扩容,按照官方文档的步骤进行。

对新节点以及已有集群节点的处理

参考上面提到的博客。

配置新节点主机名

修改各个节点的/etc/hosts文件,加上静态的域名解析

开启SELINUX

激活网络

安装及配置软件包

# yum install -y wget git net-tools bind-utils iptables-services bridge-utils bash-completion docker


配置docker

配置Master到新节点的互信

etcd节点请安装etcd

master节点更新 atomic-openshift-utils

# yum update atomic-openshift-utils


master节点编辑/etc/ansible/hosts

在原有的hosts文件上修改。示例如下:

# Create an OSEv3 group that contains the masters and nodes groups
[OSEv3:children]
masters
nodes
etcd
# 扩容
new_masters
new_nodes
new_etcd
# Set variables common for all OSEv3 hosts
[OSEv3:vars]
# SSH user, this user should allow ssh based auth without requiring a password
ansible_ssh_user=root
openshift_deployment_type=origin
openshift_release=3.6.0
openshift_disable_check=disk_availability,docker_storage,memory_availability,docker_image_availability
# uncomment the following to enable htpasswd authentication; defaults to DenyAllPasswordIdentityProvider
openshift_master_identity_providers=[{'name':'htpasswd_auth','login':'true','challenge':'true','kind':'HTPasswdPasswordIdentityProvider','filename':'/etc/origin/master/htpasswd'}]
# host group for masters
[masters]
master.example.com

# 新增master节点
[new_masters]
node1.example.com

# host group for nodes, includes region info
[nodes]
master.example.com openshift_schedulable=True openshift_node_labels="{'region': 'infra'}"
node1.example.com openshift_node_labels="{'region': 'infra', 'zone': 'east'}"
node2.example.com openshift_node_labels="{'region': 'infra', 'zone': 'west'}"

# 新增node节点
[new_nodes]
node3.example.com openshift_node_labels="{'region': 'infra', 'zone': 'default'}"

[etcd]
master.example.com

# 新增etcd节点
[new_etcd]
node1.example.com


执行扩容

注意修改脚本路径为本机路径

##master扩容

# ansible-playbook ~/openshift-ansible-openshift-ansible-3.7.0-0.126.0/playbooks/byo/openshift-master/scaleup.yml


##node扩容

# ansible-playbook ~/openshift-ansible-openshift-ansible-3.7.0-0.126.0/playbooks/byo/openshift-node/scaleup.yml


etcd扩容

# ansible-playbook ~/openshift-ansible-openshift-ansible-3.7.0-0.126.0/playbooks/byo/openshift-etcd/scaleup.yml


结语

为了保证hosts文件的持续使用,扩容完成后,需要对hosts文件进行修改,将hosts文件里的new标签内容都挪到对应的位置。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  openshift 集群扩容
相关文章推荐