mirror of https://github.com/easzlab/kubeasz.git
fix: 修复多节点部署时node没有设置hosts导致部署失败的问题
parent
1f2cda01ff
commit
b3b6bb4347
|
@ -92,18 +92,6 @@
|
||||||
shell: systemctl daemon-reload && systemctl restart kube-proxy
|
shell: systemctl daemon-reload && systemctl restart kube-proxy
|
||||||
tags: reload-kube-proxy, upgrade_k8s, restart_node, force_change_certs
|
tags: reload-kube-proxy, upgrade_k8s, restart_node, force_change_certs
|
||||||
|
|
||||||
# 设置k8s_nodename 在/etc/hosts 地址解析
|
|
||||||
- name: 设置k8s_nodename 在/etc/hosts 地址解析
|
|
||||||
lineinfile:
|
|
||||||
dest: /etc/hosts
|
|
||||||
state: present
|
|
||||||
regexp: "{{ K8S_NODENAME }}"
|
|
||||||
line: "{{ inventory_hostname }} {{ K8S_NODENAME }}"
|
|
||||||
delegate_to: "{{ item }}"
|
|
||||||
with_items: "{{ groups.kube_master }}"
|
|
||||||
when: "inventory_hostname != K8S_NODENAME"
|
|
||||||
|
|
||||||
|
|
||||||
# 轮询等待kube-proxy启动完成
|
# 轮询等待kube-proxy启动完成
|
||||||
- name: 轮询等待kube-proxy启动
|
- name: 轮询等待kube-proxy启动
|
||||||
shell: "systemctl is-active kube-proxy.service"
|
shell: "systemctl is-active kube-proxy.service"
|
||||||
|
|
|
@ -41,3 +41,13 @@
|
||||||
state: present
|
state: present
|
||||||
regexp: 'easzlab.io.local'
|
regexp: 'easzlab.io.local'
|
||||||
line: "{{ ansible_env.SSH_CLIENT.split(' ')[0] }} easzlab.io.local"
|
line: "{{ ansible_env.SSH_CLIENT.split(' ')[0] }} easzlab.io.local"
|
||||||
|
|
||||||
|
- name: 设置 k8s_nodename 在 master、node 节点 /etc/hosts 地址解析
|
||||||
|
lineinfile:
|
||||||
|
dest: /etc/hosts
|
||||||
|
state: present
|
||||||
|
regexp: "{{ K8S_NODENAME }}"
|
||||||
|
line: "{{ inventory_hostname }} {{ K8S_NODENAME }}"
|
||||||
|
delegate_to: "{{ item }}"
|
||||||
|
with_items: ["{{ groups.kube_master }}", "{{ groups.kube_node }}"]
|
||||||
|
when: "inventory_hostname != K8S_NODENAME"
|
Loading…
Reference in New Issue