更新cluster-addon部分可选自动安装nginx-ingress

pull/422/head
gjmzj 2018-12-21 22:35:15 +08:00
parent 21e6a48622
commit d6f04a96d2
3 changed files with 50 additions and 26 deletions

View File

@ -17,24 +17,26 @@ metricsserver_offline: "metrics-server_v0.3.1.tar"
dashboard_install: "yes" dashboard_install: "yes"
dashboard_offline: "dashboard_v1.10.0.tar" dashboard_offline: "dashboard_v1.10.0.tar"
# traefik-ingress 自动安装 # ingress 自动安装,可选 "traefik" 和 "nginx-ingress"
ingress_install: "no" ingress_install: "no"
ingress_backend: "traefik" ingress_backend: "traefik"
traefik_offline: "traefik_v1.7.4.tar" traefik_offline: "traefik_v1.7.4.tar"
nginx_ingress_offline: "nginx_ingress_0.21.0.tar"
# heapster 自动安装 # heapster 自动安装
heapster_install: "no" heapster_install: "no"
heapster_offline: "heapster_v1.5.4.tar" heapster_offline: "heapster_v1.5.4.tar"
# efk 自动安装
#efk_install: "no"
# prometheus 自动安装
#prometheus_install: "no"
# metallb 自动安装 # metallb 自动安装
metallb_install: "no" metallb_install: "no"
# 模式选择: 二层 "layer2" 或者三层 "bgp" # 模式选择: 二层 "layer2" 或者三层 "bgp"
metallb_protocol: "layer2" metallb_protocol: "layer2"
metallb_offline: "metallb_v0.7.3.tar" metallb_offline: "metallb_v0.7.3.tar"
metallb_vip_pool: "192.168.1.240/29" metallb_vip_pool: "192.168.1.240/29"
# efk 自动安装
#efk_install: "no"
# prometheus 自动安装
#prometheus_install: "no"

View File

@ -0,0 +1,39 @@
- block:
- name: 尝试推送离线 traefik镜像若执行失败可忽略
copy: src={{ base_dir }}/down/{{ traefik_offline }} dest=/opt/kube/images/{{ traefik_offline }}
when: 'traefik_offline in download_info.stdout'
- name: 获取traefik离线镜像推送情况
command: "ls /opt/kube/images"
register: image_info
- name: 导入 traefik的离线镜像若执行失败可忽略
shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ traefik_offline }}"
when: 'traefik_offline in image_info.stdout'
- name: 创建 traefik部署
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/ingress/traefik/traefik-ingress.yaml"
delegate_to: "{{ groups.deploy[0] }}"
run_once: true
when: 'ingress_backend == "traefik"'
ignore_errors: true
- block:
- name: 尝试推送离线 nginx-ingress镜像若执行失败可忽略
copy: src={{ base_dir }}/down/{{ nginx_ingress_offline }} dest=/opt/kube/images/{{ nginx_ingress_offline }}
when: 'nginx_ingress_offline in download_info.stdout'
- name: 获取nginx_ingress离线镜像推送情况
command: "ls /opt/kube/images"
register: image_info
- name: 导入 nginx_ingress的离线镜像若执行失败可忽略
shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ nginx_ingress_offline }}"
when: 'nginx_ingress_offline in image_info.stdout'
- name: 创建 nginx_ingress部署
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/ingress/nginx-ingress/nginx-ingress.yaml"
delegate_to: "{{ groups.deploy[0] }}"
run_once: true
when: 'ingress_backend == "nginx-ingress"'
ignore_errors: true

View File

@ -87,25 +87,8 @@
when: '"kubernetes-dashboard" not in pod_info.stdout and dashboard_install == "yes"' when: '"kubernetes-dashboard" not in pod_info.stdout and dashboard_install == "yes"'
ignore_errors: true ignore_errors: true
- block: - import_tasks: ingress.yml
- name: 尝试推送离线 traefik镜像若执行失败可忽略 when: '"ingress-controller" not in pod_info.stdout and ingress_install == "yes"'
copy: src={{ base_dir }}/down/{{ traefik_offline }} dest=/opt/kube/images/{{ traefik_offline }}
when: 'traefik_offline in download_info.stdout'
- name: 获取traefik离线镜像推送情况
command: "ls /opt/kube/images"
register: image_info
- name: 导入 traefik的离线镜像若执行失败可忽略
shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ traefik_offline }}"
when: 'traefik_offline in image_info.stdout'
- name: 创建 traefik部署
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/ingress/traefik/traefik-ingress.yaml"
delegate_to: "{{ groups.deploy[0] }}"
run_once: true
when: '"traefik-ingress-controller" not in pod_info.stdout and ingress_install == "yes"'
ignore_errors: true
- block: - block:
- name: 尝试推送离线 heapster镜像若执行失败可忽略 - name: 尝试推送离线 heapster镜像若执行失败可忽略