mirror of https://github.com/easzlab/kubeasz.git
优化增加node/增加master节点流程
parent
98e6623d10
commit
81bb83b3b7
|
@ -38,7 +38,7 @@
|
|||
lineinfile:
|
||||
dest: "{{ base_dir }}/hosts"
|
||||
state: present
|
||||
insertafter: '^\[etcd\]'
|
||||
insertafter: '^\[etcd'
|
||||
firstmatch: yes
|
||||
line: "{{ inventory_hostname }} NODE_NAME={{ NODE_NAME }}"
|
||||
connection: local
|
||||
|
|
|
@ -9,3 +9,31 @@
|
|||
- { role: cilium, when: "CLUSTER_NETWORK == 'cilium'" }
|
||||
- { role: flannel, when: "CLUSTER_NETWORK == 'flannel'" }
|
||||
- { role: kube-router, when: "CLUSTER_NETWORK == 'kube-router'" }
|
||||
|
||||
# modify the ansible hosts file
|
||||
- hosts:
|
||||
- new-node
|
||||
tasks:
|
||||
- name: tag new-node FINISHED=yes
|
||||
shell: 'sed -i "/\[new-node/,/\[harbor/s/{{ inventory_hostname }}/{{ inventory_hostname }} FINISHED=yes/" {{ base_dir }}/hosts'
|
||||
args:
|
||||
warn: false
|
||||
connection: local
|
||||
|
||||
- name: cp new-node to 'kube-node' group
|
||||
lineinfile:
|
||||
dest: "{{ base_dir }}/hosts"
|
||||
state: present
|
||||
insertafter: '^\[kube-node'
|
||||
firstmatch: yes
|
||||
line: "{{ inventory_hostname }} NEW_NODE=yes"
|
||||
connection: local
|
||||
|
||||
- hosts: deploy
|
||||
tasks:
|
||||
- name: rm new-node in ansible hosts
|
||||
lineinfile:
|
||||
dest: "{{ base_dir }}/hosts"
|
||||
state: absent
|
||||
regexp: 'FINISHED=yes'
|
||||
connection: local
|
||||
|
|
|
@ -27,3 +27,31 @@
|
|||
shell: "{{ bin_dir }}/kubectl label node {{ inventory_hostname }} kubernetes.io/role=master --overwrite"
|
||||
ignore_errors: true
|
||||
delegate_to: "{{ groups.deploy[0] }}"
|
||||
|
||||
# modify the ansible hosts file
|
||||
- hosts:
|
||||
- new-master
|
||||
tasks:
|
||||
- name: tag new-master FINISHED=yes
|
||||
shell: 'sed -i "/\[new-master/,/\[kube-node/s/{{ inventory_hostname }}/{{ inventory_hostname }} FINISHED=yes/" {{ base_dir }}/hosts'
|
||||
args:
|
||||
warn: false
|
||||
connection: local
|
||||
|
||||
- name: cp new-master to 'kube-master' group
|
||||
lineinfile:
|
||||
dest: "{{ base_dir }}/hosts"
|
||||
state: present
|
||||
insertafter: '^\[kube-master'
|
||||
firstmatch: yes
|
||||
line: "{{ inventory_hostname }} NEW_MASTER=yes"
|
||||
connection: local
|
||||
|
||||
- hosts: deploy
|
||||
tasks:
|
||||
- name: rm new-master in ansible hosts
|
||||
lineinfile:
|
||||
dest: "{{ base_dir }}/hosts"
|
||||
state: absent
|
||||
regexp: 'FINISHED=yes'
|
||||
connection: local
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
- 新节点安装 kube-node 服务
|
||||
- 新节点安装网络插件相关
|
||||
- 禁止业务 pod调度到新master节点
|
||||
- 修改hosts文件,把 new-master 组成员转移到 kube-master 组
|
||||
|
||||
### 操作步骤
|
||||
|
||||
|
@ -54,3 +55,5 @@ NAME STATUS ROLES AGE VERSION
|
|||
### 后续
|
||||
|
||||
上述步骤验证成功,确认新节点工作正常后,为了方便后续再次添加节点,在ansible hosts文件中,把 [new-master] 组下的节点全部复制到 [kube-master] 组下,并清空 [new-master] 组中的节点。
|
||||
|
||||
- 注:新版本 kubeasz 已经自动完成 new-master 组成员转移到 kube-master 组
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
- 新节点安装 docker 服务
|
||||
- 新节点安装 kube-node 服务
|
||||
- 新节点安装网络插件相关
|
||||
- 修改hosts文件,把 new-node 组成员转移到 kube-node 组
|
||||
|
||||
### 操作步骤
|
||||
|
||||
|
@ -40,3 +41,5 @@ $ kubectl get pod -n kube-system
|
|||
### 后续
|
||||
|
||||
上述步骤验证成功,确认新节点工作正常后,为了方便后续再次添加节点,在ansible hosts文件中,把 [new-node] 组下的节点全部复制到 [kube-node] 组下,并清空 [new-node] 组的节点。
|
||||
|
||||
- 注:新版本 kubeasz 已经自动完成 new-node 组成员转移到 kube-node 组
|
||||
|
|
Loading…
Reference in New Issue