openshift/origin學習記錄(13)——集羣節點擴容(Master/node/etcd)

集羣搭建成功之後,可以對集羣進行擴容,包括對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標籤內容都挪到對應的位置。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章