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

来源:互联网 发布:springboot修改端口 编辑:程序博客网 时间:2024/04/30 00:32

集群搭建成功之后,可以对集群进行扩容,包括对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]mastersnodesetcd# 扩容new_mastersnew_nodesnew_etcd# Set variables common for all OSEv3 hosts[OSEv3:vars]# SSH user, this user should allow ssh based auth without requiring a passwordansible_ssh_user=rootopenshift_deployment_type=originopenshift_release=3.6.0openshift_disable_check=disk_availability,docker_storage,memory_availability,docker_image_availability# uncomment the following to enable htpasswd authentication; defaults to DenyAllPasswordIdentityProvideropenshift_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标签内容都挪到对应的位置。

阅读全文
0 0
原创粉丝点击