cluster-addon: 自动安装traefik,调整dashboard离线安装

pull/641/head
gjmzj 2019-06-13 17:16:52 +08:00
parent d4d98ee8ba
commit 6f9b6dc4a3
2 changed files with 26 additions and 19 deletions

View File

@ -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"

View File

@ -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"