fix: change cni bin directory t0 /opt/cni/bin #1248

v3.3
gjmzj 2023-04-02 22:41:59 +08:00
parent 54bae288ba
commit e2bd948db4
11 changed files with 15 additions and 28 deletions

View File

@ -442,7 +442,7 @@ spec:
# Used to install CNI. # Used to install CNI.
- name: cni-bin-dir - name: cni-bin-dir
hostPath: hostPath:
path: {{ bin_dir }} path: /opt/cni/bin
- name: cni-net-dir - name: cni-net-dir
hostPath: hostPath:
path: /etc/cni/net.d path: /etc/cni/net.d

View File

@ -463,7 +463,7 @@ spec:
# Used to install CNI. # Used to install CNI.
- name: cni-bin-dir - name: cni-bin-dir
hostPath: hostPath:
path: {{ bin_dir }} path: /opt/cni/bin
- name: cni-net-dir - name: cni-net-dir
hostPath: hostPath:
path: /etc/cni/net.d path: /etc/cni/net.d

View File

@ -521,7 +521,7 @@ spec:
# Used to install CNI. # Used to install CNI.
- name: cni-bin-dir - name: cni-bin-dir
hostPath: hostPath:
path: {{ bin_dir }} path: /opt/cni/bin
- name: cni-net-dir - name: cni-net-dir
hostPath: hostPath:
path: /etc/cni/net.d path: /etc/cni/net.d

View File

@ -18,7 +18,7 @@ resources:
memory: 512Mi memory: 512Mi
cni: cni:
binPath: {{ bin_dir }} binPath: /opt/cni/bin
containerRuntime: containerRuntime:
integration: containerd integration: containerd

View File

@ -69,7 +69,7 @@ version = 2
unset_seccomp_profile = "" unset_seccomp_profile = ""
[plugins."io.containerd.grpc.v1.cri".cni] [plugins."io.containerd.grpc.v1.cri".cni]
bin_dir = "{{ bin_dir }}" bin_dir = "/opt/cni/bin"
conf_dir = "/etc/cni/net.d" conf_dir = "/etc/cni/net.d"
conf_template = "/etc/cni/net.d/10-default.conf" conf_template = "/etc/cni/net.d/10-default.conf"
max_conf_num = 1 max_conf_num = 1

View File

@ -1,11 +1,3 @@
- name: 下载cni plugins
copy: src={{ base_dir }}/bin/{{ item }} dest={{ bin_dir }}/{{ item }} mode=0755
with_items:
- bridge
- host-local
- loopback
- portmap
- name: 配置 flannel DaemonSet yaml文件 - name: 配置 flannel DaemonSet yaml文件
template: src=kube-flannel.yaml.j2 dest={{ cluster_dir }}/yml/flannel.yaml template: src=kube-flannel.yaml.j2 dest={{ cluster_dir }}/yml/flannel.yaml
run_once: true run_once: true

View File

@ -184,7 +184,7 @@ spec:
path: /run/flannel path: /run/flannel
- name: cni-plugin - name: cni-plugin
hostPath: hostPath:
path: {{ bin_dir }} path: /opt/cni/bin
- name: cni - name: cni
hostPath: hostPath:
path: /etc/cni/net.d path: /etc/cni/net.d

View File

@ -3,18 +3,22 @@
with_items: with_items:
- /var/lib/kubelet - /var/lib/kubelet
- /var/lib/kube-proxy - /var/lib/kube-proxy
- /etc/cni/net.d
- /opt/cni/bin
- name: 下载 kubelet,kube-proxy 二进制和基础 cni plugins - name: 下载 kubelet,kube-proxy 二进制
copy: src={{ base_dir }}/bin/{{ item }} dest={{ bin_dir }}/{{ item }} mode=0755 copy: src={{ base_dir }}/bin/{{ item }} dest={{ bin_dir }}/{{ item }} mode=0755
with_items: with_items:
- kubectl - kubectl
- kubelet - kubelet
- kube-proxy - kube-proxy
- bridge
- host-local
- loopback
tags: upgrade_k8s tags: upgrade_k8s
- name: 下载 cni plugins 二进制文件
copy: src={{ item }} dest=/opt/cni/bin/ mode=0755
with_fileglob:
- {{ base_dir }}/bin/cni-bin/*
- name: 添加 kubectl 自动补全 - name: 添加 kubectl 自动补全
lineinfile: lineinfile:
dest: ~/.bashrc dest: ~/.bashrc

View File

@ -214,7 +214,7 @@ spec:
path: /etc/cni/net.d path: /etc/cni/net.d
- name: cni-bin - name: cni-bin
hostPath: hostPath:
path: {{ bin_dir }} path: /opt/cni/bin
- name: host-ns - name: host-ns
hostPath: hostPath:
path: /var/run/netns path: /var/run/netns

View File

@ -1,11 +1,3 @@
- name: 下载cni plugins
copy: src={{ base_dir }}/bin/{{ item }} dest={{ bin_dir }}/{{ item }} mode=0755
with_items:
- bridge
- host-local
- loopback
- portmap
- name: 准备配置 kube-router DaemonSet (without IPVS) - name: 准备配置 kube-router DaemonSet (without IPVS)
template: src=kuberouter.yaml.j2 dest={{ cluster_dir }}/yml/kube-router.yaml template: src=kuberouter.yaml.j2 dest={{ cluster_dir }}/yml/kube-router.yaml
run_once: true run_once: true

View File

@ -21,7 +21,6 @@
- "{{ bin_dir }}" - "{{ bin_dir }}"
- "{{ ca_dir }}" - "{{ ca_dir }}"
- /root/.kube - /root/.kube
- /etc/cni/net.d
# 某些系统没有/usr/bin/python需要配置一个软链接否则connection: local的任务会失败 # 某些系统没有/usr/bin/python需要配置一个软链接否则connection: local的任务会失败
# 如果仍旧出现任务失败,重新执行一遍即可 https://github.com/ansible/ansible/issues/64903 # 如果仍旧出现任务失败,重新执行一遍即可 https://github.com/ansible/ansible/issues/64903