diff --git a/down/offline_images b/down/offline_images index d73c531..a1b9601 100644 --- a/down/offline_images +++ b/down/offline_images @@ -7,14 +7,14 @@ mirrorgooglecontainers/k8s-dns-sidecar-amd64:1.14.10 # metrics-server 插件 mirrorgooglecontainers/metrics-server-amd64:v0.2.1 # calico 网络插件 -calico/node:v3.0.6 -calico/cni:v2.0.5 -calico/kube-controllers:v2.0.4 +calico/node:v3.1.3 +calico/cni:v3.1.3 +calico/kube-controllers:v3.1.3 # flannel 网络插件 jmgao1983/flannel:v0.10.0-amd64 # kube-router 网络插件 -cloudnativelabs/kube-router -busybox +cloudnativelabs/kube-router:v0.2.0-beta.9 +busybox:1.28.4 # dashboard 插件 mirrorgooglecontainers/kubernetes-dashboard-amd64:v1.8.3 # pause 基础容器镜像 diff --git a/roles/kube-router/defaults/main.yml b/roles/kube-router/defaults/main.yml index 4b25f14..adcec5d 100644 --- a/roles/kube-router/defaults/main.yml +++ b/roles/kube-router/defaults/main.yml @@ -10,8 +10,10 @@ FIREWALL_ENABLE: "true" SERVICE_PROXY: "false" # kube-router 镜像版本 -IMAGE: "cloudnativelabs/kube-router" +kube_router_ver: "v0.2.0-beta.9" +busybox_ver: "1.28.4" PullPolicy: "IfNotPresent" # kube-router 离线镜像tar包 -kuberouter_offline: "kube-router_v0.2.0-beta.7.tar" +kuberouter_offline: "kube-router_{{ kube_router_ver }}.tar" +busybox_offline: "busybox_{{ busybox_ver }}.tar" diff --git a/roles/kube-router/tasks/main.yml b/roles/kube-router/tasks/main.yml index 793b152..87a51ee 100644 --- a/roles/kube-router/tasks/main.yml +++ b/roles/kube-router/tasks/main.yml @@ -18,6 +18,7 @@ template: src=kuberouter.yaml.j2 dest=/opt/kube/kube-system/kube-router/kuberouter.yaml when: 'SERVICE_PROXY != "true"' +# kube-router 带service proxy (IPVS/LVS) - name: 停止 kube-proxy 服务 service: name=kube-proxy state=stopped enabled=no when: 'SERVICE_PROXY == "true"' @@ -28,7 +29,6 @@ when: 'SERVICE_PROXY == "true"' ignore_errors: true -# kube-router 带service proxy (IPVS/LVS) - name: 准备配置 kube-router DaemonSet (with IPVS) template: src=kuberouter-all.yaml.j2 dest=/opt/kube/kube-system/kube-router/kuberouter.yaml when: 'SERVICE_PROXY == "true"' @@ -39,6 +39,7 @@ with_items: - "pause_3.1.tar" - "{{ kuberouter_offline }}" + - "{{ busybox_offline }}" ignore_errors: true - name: 获取目录下离线镜像信息 @@ -47,14 +48,12 @@ # 如果目录下有离线镜像,就把它导入到node节点上 - name: 导入 kube-router的离线镜像(若执行失败,可忽略) - shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ kuberouter_offline }}" - when: 'kuberouter_offline in image_info.stdout' - ignore_errors: true - -# 如果目录下有离线镜像,就把它导入到node节点上 -- name: 导入 pause的离线镜像(若执行失败,可忽略) - shell: "{{ bin_dir }}/docker load -i /opt/kube/images/pause_3.1.tar" - when: '"pause_3" in image_info.stdout' + shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ item }}" + when: 'item in image_info.stdout' + with_items: + - "pause_3.1.tar" + - "{{ kuberouter_offline }}" + - "{{ busybox_offline }}" ignore_errors: true # 只需单节点执行一次 diff --git a/roles/kube-router/templates/kuberouter-all.yaml.j2 b/roles/kube-router/templates/kuberouter-all.yaml.j2 index f7dd505..8a98db7 100644 --- a/roles/kube-router/templates/kuberouter-all.yaml.j2 +++ b/roles/kube-router/templates/kuberouter-all.yaml.j2 @@ -58,7 +58,7 @@ spec: serviceAccountName: kube-router containers: - name: kube-router - image: {{ IMAGE }} + image: cloudnativelabs/kube-router:{{ kube_router_ver }} imagePullPolicy: {{ PullPolicy }} args: - "--run-router=true" @@ -93,7 +93,7 @@ spec: readOnly: true initContainers: - name: install-cni - image: busybox + image: busybox:{{ busybox_ver }} imagePullPolicy: {{ PullPolicy }} command: - /bin/sh diff --git a/roles/kube-router/templates/kuberouter.yaml.j2 b/roles/kube-router/templates/kuberouter.yaml.j2 index a5257f1..5080b05 100644 --- a/roles/kube-router/templates/kuberouter.yaml.j2 +++ b/roles/kube-router/templates/kuberouter.yaml.j2 @@ -39,7 +39,7 @@ spec: serviceAccountName: kube-router containers: - name: kube-router - image: {{ IMAGE }} + image: cloudnativelabs/kube-router:{{ kube_router_ver }} imagePullPolicy: {{ PullPolicy }} args: - "--run-router=true" @@ -70,7 +70,7 @@ spec: mountPath: /etc/cni/net.d initContainers: - name: install-cni - image: busybox + image: busybox:{{ busybox_ver }} imagePullPolicy: {{ PullPolicy }} command: - /bin/sh