diff --git a/ansible.hosts.ha.publicnetwork.tpl b/ansible.hosts.ha.publicnetwork.tpl index 95a574b..075472c 100644 --- a/ansible.hosts.ha.publicnetwork.tpl +++ b/ansible.hosts.ha.publicnetwork.tpl @@ -46,8 +46,8 @@ service_subnet=10.96.0.0/12 pod_subnet=10.128.0.0/16 # helm -helm_binary_md5=e4500993ba21e5e6bdfbc084b4342025 -helm_binary_url=https://pnode.solarfs.io/dn/file/{{helm_binary_md5}}/helm-v3.6.0-linux-amd64.tar.gz +helm_binary_md5=77b16cb0ebc6266ac98fc9f2285e361f +helm_binary_url=https://pnode.solarfs.io/dn/file/{{helm_binary_md5}}/helm-v3.7.1-linux-amd64.tar.gz # os id, centos|ubuntu OS_ID="centos" diff --git a/ansible.hosts.ha.tpl b/ansible.hosts.ha.tpl index d4ece8d..63c1dfb 100644 --- a/ansible.hosts.ha.tpl +++ b/ansible.hosts.ha.tpl @@ -46,8 +46,8 @@ service_subnet=10.96.0.0/12 pod_subnet=10.128.0.0/16 # helm -helm_binary_md5=e4500993ba21e5e6bdfbc084b4342025 -helm_binary_url=https://pnode.solarfs.io/dn/file/{{helm_binary_md5}}/helm-v3.6.0-linux-amd64.tar.gz +helm_binary_md5=77b16cb0ebc6266ac98fc9f2285e361f +helm_binary_url=https://pnode.solarfs.io/dn/file/{{helm_binary_md5}}/helm-v3.7.1-linux-amd64.tar.gz # os id, centos|ubuntu OS_ID="centos" diff --git a/ansible.hosts.ha.vip.tpl b/ansible.hosts.ha.vip.tpl index 63906b3..6a094c6 100644 --- a/ansible.hosts.ha.vip.tpl +++ b/ansible.hosts.ha.vip.tpl @@ -59,8 +59,8 @@ ingress_nodeport_http=32080 ingress_nodeport_https=32443 # helm -helm_binary_md5=e4500993ba21e5e6bdfbc084b4342025 -helm_binary_url=https://pnode.solarfs.io/dn/file/{{helm_binary_md5}}/helm-v3.6.0-linux-amd64.tar.gz +helm_binary_md5=77b16cb0ebc6266ac98fc9f2285e361f +helm_binary_url=https://pnode.solarfs.io/dn/file/{{helm_binary_md5}}/helm-v3.7.1-linux-amd64.tar.gz # os id, centos|ubuntu OS_ID="centos" diff --git a/ansible.hosts.tpl b/ansible.hosts.tpl index ed63909..e0c2c3c 100644 --- a/ansible.hosts.tpl +++ b/ansible.hosts.tpl @@ -47,8 +47,8 @@ service_subnet=10.96.0.0/12 pod_subnet=10.128.0.0/16 # helm -helm_binary_md5=24b16800f8c7f44b5dd128e3355ecf1b -helm_binary_url=https://pnode.solarfs.io/dn/file/{{helm_binary_md5}}/helm-v3.6.3-linux-amd64.tar.gz +helm_binary_md5=77b16cb0ebc6266ac98fc9f2285e361f +helm_binary_url=https://pnode.solarfs.io/dn/file/{{helm_binary_md5}}/helm-v3.7.1-linux-amd64.tar.gz # os id, centos|ubuntu OS_ID="centos" diff --git a/roles/host-init/tasks/publicInterface.yml b/roles/host-init/tasks/publicInterface.yml index 9317b28..3097d78 100644 --- a/roles/host-init/tasks/publicInterface.yml +++ b/roles/host-init/tasks/publicInterface.yml @@ -2,5 +2,5 @@ service: name=NetworkManager state=started enabled=yes - name: Configure the public network card - shell: nmcli connection add type tun ifname pip0 con-name pip0 mode tap ip4 {{ advertise_address }}/24 + shell: nmcli connection add type tun ifname pip0 con-name pip0 mode tap ip4 {{ advertise_address }}/32 tags: publicNetwork diff --git a/roles/host-init/tasks/update.yml b/roles/host-init/tasks/update.yml index 5607564..bce0f2c 100644 --- a/roles/host-init/tasks/update.yml +++ b/roles/host-init/tasks/update.yml @@ -1,5 +1,5 @@ - name: yum update - command: yum update -y + command: yum update -y --exclude=kubelet --exclude=kubeadm --exclude=docker --exclude=runc tags: yum-update when: OS_ID == "centos" diff --git a/roles/k8s-masters/handlers/main.yml b/roles/k8s-masters/handlers/main.yml index 7c3075a..9830f34 100644 --- a/roles/k8s-masters/handlers/main.yml +++ b/roles/k8s-masters/handlers/main.yml @@ -7,3 +7,8 @@ - name: restart coredns shell: "kubectl rollout restart deploy coredns -n kube-system" + become: yes + +- name: restart kubelet + service: name=kubelet state=restarted + become: yes diff --git a/roles/k8s-masters/tasks/kubelet.yml b/roles/k8s-masters/tasks/kubelet.yml new file mode 100644 index 0000000..ba1e2de --- /dev/null +++ b/roles/k8s-masters/tasks/kubelet.yml @@ -0,0 +1,4 @@ +--- +- name: config /etc/sysconfig/kubelet + template: src=kubelet.j2 dest=/etc/sysconfig/kubelet mode=0644 + tags: join-node diff --git a/roles/k8s-masters/tasks/main.yml b/roles/k8s-masters/tasks/main.yml index e696b21..b83b8bc 100644 --- a/roles/k8s-masters/tasks/main.yml +++ b/roles/k8s-masters/tasks/main.yml @@ -5,6 +5,7 @@ - include: apiServerDns.yml - include: kubeadmInit.yml when: hostvars[ groups['masters'][0] ].inventory_hostname == inventory_hostname +- include: kubelet.yml - include: joinControlPlane.yml - include: kube-flannel.yml when: hostvars[ groups['masters'][0] ].inventory_hostname == inventory_hostname and flannel_enable == True diff --git a/roles/k8s-masters/templates/kubelet.j2 b/roles/k8s-masters/templates/kubelet.j2 new file mode 100644 index 0000000..5f2055f --- /dev/null +++ b/roles/k8s-masters/templates/kubelet.j2 @@ -0,0 +1 @@ +KUBELET_EXTRA_ARGS="--node-ip {{ advertise_address }}" diff --git a/roles/k8s-nodes/tasks/joinNode.yml b/roles/k8s-nodes/tasks/joinNode.yml index 67f04b6..77c9db0 100644 --- a/roles/k8s-nodes/tasks/joinNode.yml +++ b/roles/k8s-nodes/tasks/joinNode.yml @@ -4,6 +4,10 @@ register: check_kubelet_conf tags: join-node +- name: config /etc/sysconfig/kubelet + template: src=kubelet.j2 dest=/etc/sysconfig/kubelet mode=0644 + tags: join-node + - name: join k8s nodes command: "{{hostvars[ groups['masters'][0] ].join_command.stdout}}" when: check_kubelet_conf.stat.exists == False and public_network_node == False diff --git a/roles/k8s-nodes/templates/kubelet.j2 b/roles/k8s-nodes/templates/kubelet.j2 new file mode 100644 index 0000000..5f2055f --- /dev/null +++ b/roles/k8s-nodes/templates/kubelet.j2 @@ -0,0 +1 @@ +KUBELET_EXTRA_ARGS="--node-ip {{ advertise_address }}"