From 6f9b6dc4a3272bfc3551eb3010fc57df3a7103fa Mon Sep 17 00:00:00 2001 From: gjmzj Date: Thu, 13 Jun 2019 17:16:52 +0800 Subject: [PATCH] =?UTF-8?q?cluster-addon:=20=E8=87=AA=E5=8A=A8=E5=AE=89?= =?UTF-8?q?=E8=A3=85traefik=EF=BC=8C=E8=B0=83=E6=95=B4dashboard=E7=A6=BB?= =?UTF-8?q?=E7=BA=BF=E5=AE=89=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- roles/cluster-addon/defaults/main.yml | 12 ++++------ roles/cluster-addon/tasks/main.yml | 33 +++++++++++++++++---------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/roles/cluster-addon/defaults/main.yml b/roles/cluster-addon/defaults/main.yml index ee7899c..a4404d1 100644 --- a/roles/cluster-addon/defaults/main.yml +++ b/roles/cluster-addon/defaults/main.yml @@ -17,23 +17,21 @@ metricsVer: "v0.3.2" metricsserver_offline: "metrics-server_{{ metricsVer }}.tar" # dashboard 自动安装 +# 现阶段 dashboard 获取metrics仍旧依赖于heapster,因此需连带安装heapster dashboard_install: "yes" dashboardVer: "v1.10.1" dashboard_offline: "dashboard_{{ dashboardVer }}.tar" +heapsterVer: "v1.5.4" +heapster_offline: "heapster_{{ heapsterVer }}.tar" # ingress 自动安装,可选 "traefik" 和 "nginx-ingress" -ingress_install: "no" +ingress_install: "yes" ingress_backend: "traefik" -traefikVer: "v1.7.11" +traefikVer: "v1.7.12" nginxingVer: "0.21.0" traefik_offline: "traefik_{{ traefikVer }}.tar" nginx_ingress_offline: "nginx_ingress_{{ nginxingVer }}.tar" -# heapster 自动安装 -heapster_install: "no" -heapsterVer: "v1.5.4" -heapster_offline: "heapster_{{ heapsterVer }}.tar" - # metallb 自动安装 metallb_install: "no" metallbVer: "v0.7.3" diff --git a/roles/cluster-addon/tasks/main.yml b/roles/cluster-addon/tasks/main.yml index 5140645..f5205a9 100644 --- a/roles/cluster-addon/tasks/main.yml +++ b/roles/cluster-addon/tasks/main.yml @@ -84,22 +84,31 @@ # 现阶段 dashboard 获取metrics仍旧依赖于heapster,因此需连带安装heapster - block: - block: - - name: 尝试推送离线 dashboard镜像(若执行失败,可忽略) - copy: src={{ base_dir }}/down/{{ dashboard_offline }} dest=/opt/kube/images/{{ dashboard_offline }} - when: 'dashboard_offline in download_info.stdout' - + - name: 尝试推送离线 dashboard heapster镜像(若执行失败,可忽略) + copy: src={{ base_dir }}/down/{{ item }} dest=/opt/kube/images/{{ item }} + when: 'item in download_info.stdout' + with_items: + - "{{ dashboard_offline }}" + - "{{ heapster_offline }}" + - name: 获取dashboard离线镜像推送情况 command: "ls /opt/kube/images" register: image_info - - name: 导入 dashboard的离线镜像(若执行失败,可忽略) - shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ dashboard_offline }}" - when: 'dashboard_offline in image_info.stdout and CONTAINER_RUNTIME == "docker"' - - - name: 导入 dashboard的离线镜像(若执行失败,可忽略) - shell: "{{ bin_dir }}/ctr -n=k8s.io images import /opt/kube/images/{{ dashboard_offline }}" - when: 'dashboard_offline in image_info.stdout and CONTAINER_RUNTIME == "containerd"' - + - name: 导入 dashboard heapster的离线镜像(docker) + shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ item }}" + with_items: + - "{{ dashboard_offline }}" + - "{{ heapster_offline }}" + when: "item in image_info.stdout and CONTAINER_RUNTIME == 'docker'" + + - name: 导入 dashboard heapster的离线镜像(containerd) + shell: "{{ bin_dir }}/ctr -n=k8s.io images import /opt/kube/images/{{ item }}" + with_items: + - "{{ dashboard_offline }}" + - "{{ heapster_offline }}" + when: "item in image_info.stdout and CONTAINER_RUNTIME == 'containerd'" + - name: 创建 dashboard部署 shell: "{{ base_dir }}/bin/kubectl apply -f {{ base_dir }}/manifests/dashboard && \ {{ base_dir }}/bin/kubectl apply -f {{ base_dir }}/manifests/heapster/heapster-only"