From 8f90571234704278b22212dc6a249d9b7c649168 Mon Sep 17 00:00:00 2001 From: gjmzj Date: Thu, 21 May 2020 10:41:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=83=A8=E5=88=86=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- roles/calico/defaults/main.yml | 3 +- roles/cluster-addon/defaults/main.yml | 24 ++++------ roles/cluster-addon/tasks/main.yml | 64 +++++++++++++-------------- roles/flannel/defaults/main.yml | 5 ++- tools/easzup | 9 +--- 5 files changed, 48 insertions(+), 57 deletions(-) diff --git a/roles/calico/defaults/main.yml b/roles/calico/defaults/main.yml index daf3e44..131b25c 100644 --- a/roles/calico/defaults/main.yml +++ b/roles/calico/defaults/main.yml @@ -19,7 +19,8 @@ FELIX_LOG_LVL: "warning" IP_AUTODETECTION_METHOD: "can-reach={{ groups['kube-master'][0] }}" # 更新支持calico 版本: [v3.2.x] [v3.3.x] [v3.4.x] -calico_ver: "v3.4.4" +calicoVer: "v3.8.8" +calico_ver: "{{ calicoVer }}" # calico 主版本 calico_ver_main: "{{ calico_ver.split('.')[0] }}.{{ calico_ver.split('.')[1] }}" diff --git a/roles/cluster-addon/defaults/main.yml b/roles/cluster-addon/defaults/main.yml index 1a697d3..8bec89c 100644 --- a/roles/cluster-addon/defaults/main.yml +++ b/roles/cluster-addon/defaults/main.yml @@ -4,7 +4,7 @@ dns_backend: "coredns" # 设置 dns svc ip (这里选用 SERVICE_CIDR 中第2个IP) CLUSTER_DNS_SVC_IP: "{{ SERVICE_CIDR | ipaddr('net') | ipaddr(2) | ipaddr('address') }}" kubednsVer: "1.14.13" -corednsVer: "1.6.6" +corednsVer: "1.6.7" kubedns_offline: "kubedns_{{ kubednsVer }}.tar" coredns_offline: "coredns_{{ corednsVer }}.tar" dns_offline: "{%- if dns_backend == 'coredns' -%} \ @@ -21,30 +21,24 @@ metricsserver_offline: "metrics-server_{{ metricsVer }}.tar" # dashboard 自动安装 # dashboard v2.x.x 不依赖于heapster dashboard_install: "yes" -dashboardVer: "v2.0.0-rc3" +dashboardVer: "v2.0.0" dashboard_offline: "dashboard_{{ dashboardVer }}.tar" -dashboardMetricsScraperVer: "v1.0.3" +dashboardMetricsScraperVer: "v1.0.4" metricsscraper_offline: "metrics-scraper_{{ dashboardMetricsScraperVer }}.tar" # ingress 自动安装,可选 "traefik" 和 "nginx-ingress" -ingress_install: "yes" -ingress_backend: "traefik" -traefikVer: "v1.7.20" -nginxingVer: "0.21.0" -traefik_offline: "traefik_{{ traefikVer }}.tar" -nginx_ingress_offline: "nginx_ingress_{{ nginxingVer }}.tar" +#ingress_install: "no" # metallb 自动安装 -metallb_install: "no" -metallbVer: "v0.7.3" +#metallb_install: "no" +#metallbVer: "v0.7.3" # 模式选择: 二层 "layer2" 或者三层 "bgp" -metallb_protocol: "layer2" -metallb_offline: "metallb_{{ metallbVer }}.tar" -metallb_vip_pool: "192.168.1.240/29" +#metallb_protocol: "layer2" +#metallb_offline: "metallb_{{ metallbVer }}.tar" +#metallb_vip_pool: "192.168.1.240/29" # efk 自动安装 #efk_install: "no" # prometheus 自动安装 #prometheus_install: "no" - diff --git a/roles/cluster-addon/tasks/main.yml b/roles/cluster-addon/tasks/main.yml index acd6d68..1c5b69d 100644 --- a/roles/cluster-addon/tasks/main.yml +++ b/roles/cluster-addon/tasks/main.yml @@ -108,36 +108,36 @@ when: '"kubernetes-dashboard" not in pod_info.stdout and dashboard_install == "yes"' ignore_errors: true -- import_tasks: ingress.yml - when: '"ingress-controller" not in pod_info.stdout and ingress_install == "yes"' +#- import_tasks: ingress.yml +# when: '"ingress-controller" not in pod_info.stdout and ingress_install == "yes"' -- block: - - block: - - name: 尝试推送离线 metallb镜像(若执行失败,可忽略) - copy: src={{ base_dir }}/down/{{ metallb_offline }} dest=/opt/kube/images/{{ metallb_offline }} - when: 'metallb_offline in download_info.stdout' - - - name: 获取metallb离线镜像推送情况 - command: "ls /opt/kube/images" - register: image_info - - - name: 导入 metallb的离线镜像(若执行失败,可忽略) - shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ metallb_offline }}" - when: 'metallb_offline in image_info.stdout and CONTAINER_RUNTIME == "docker"' - - - name: 导入 metallb的离线镜像(若执行失败,可忽略) - shell: "{{ bin_dir }}/ctr -n=k8s.io images import /opt/kube/images/{{ metallb_offline }}" - when: 'metallb_offline in image_info.stdout and CONTAINER_RUNTIME == "containerd"' - - - name: 生成 metallb 相关 manifests - template: src=metallb/{{ item }}.j2 dest=/opt/kube/kube-system/{{ item }} - with_items: - - "metallb.yaml" - - "{{ metallb_protocol }}.yaml" - - - name: 创建 metallb controller 部署 - shell: "{{ bin_dir }}/kubectl apply -f /opt/kube/kube-system/metallb.yaml && \ - {{ bin_dir }}/kubectl apply -f /opt/kube/kube-system/{{ metallb_protocol }}.yaml" - run_once: true - when: '"metallb" not in pod_info.stdout and metallb_install == "yes"' - ignore_errors: true +#- block: +# - block: +# - name: 尝试推送离线 metallb镜像(若执行失败,可忽略) +# copy: src={{ base_dir }}/down/{{ metallb_offline }} dest=/opt/kube/images/{{ metallb_offline }} +# when: 'metallb_offline in download_info.stdout' +# +# - name: 获取metallb离线镜像推送情况 +# command: "ls /opt/kube/images" +# register: image_info +# +# - name: 导入 metallb的离线镜像(若执行失败,可忽略) +# shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ metallb_offline }}" +# when: 'metallb_offline in image_info.stdout and CONTAINER_RUNTIME == "docker"' +# +# - name: 导入 metallb的离线镜像(若执行失败,可忽略) +# shell: "{{ bin_dir }}/ctr -n=k8s.io images import /opt/kube/images/{{ metallb_offline }}" +# when: 'metallb_offline in image_info.stdout and CONTAINER_RUNTIME == "containerd"' +# +# - name: 生成 metallb 相关 manifests +# template: src=metallb/{{ item }}.j2 dest=/opt/kube/kube-system/{{ item }} +# with_items: +# - "metallb.yaml" +# - "{{ metallb_protocol }}.yaml" +# +# - name: 创建 metallb controller 部署 +# shell: "{{ bin_dir }}/kubectl apply -f /opt/kube/kube-system/metallb.yaml && \ +# {{ bin_dir }}/kubectl apply -f /opt/kube/kube-system/{{ metallb_protocol }}.yaml" +# run_once: true +# when: '"metallb" not in pod_info.stdout and metallb_install == "yes"' +# ignore_errors: true diff --git a/roles/flannel/defaults/main.yml b/roles/flannel/defaults/main.yml index 92452ed..4cf618f 100644 --- a/roles/flannel/defaults/main.yml +++ b/roles/flannel/defaults/main.yml @@ -6,7 +6,8 @@ FLANNEL_BACKEND: "vxlan" DIRECT_ROUTING: false #flanneld_image: "quay.io/coreos/flannel:v0.10.0-amd64" -flanneld_image: "easzlab/flannel:v0.11.0-amd64" +flannelVer: "v0.12.0-amd64" +flanneld_image: "easzlab/flannel:{{ flannelVer }}" # 离线镜像tar包 -flannel_offline: "flannel_v0.11.0-amd64.tar" +flannel_offline: "flannel_{{ flannelVer }}.tar" diff --git a/tools/easzup b/tools/easzup index ceae310..e78941f 100755 --- a/tools/easzup +++ b/tools/easzup @@ -15,9 +15,9 @@ set -o errexit # default version, can be overridden by cmd line options export DOCKER_VER=19.03.8 -export KUBEASZ_VER=2.2.0 +export KUBEASZ_VER=2.3.0 export K8S_BIN_VER=v1.18.2 -export EXT_BIN_VER=0.4.0 +export EXT_BIN_VER=0.5.0 export SYS_PKG_VER=0.3.3 function install_docker() { @@ -190,7 +190,6 @@ function get_offline_image() { flannelVer=v0.12.0-amd64 metricsVer=v0.3.6 pauseVer=3.2 - traefikVer=v1.7.20 imageDir=/etc/ansible/down [[ -d "$imageDir" ]] || { echo "[ERROR] $imageDir not existed!"; exit 1; } @@ -228,10 +227,6 @@ function get_offline_image() { docker save -o ${imageDir}/pause_${pauseVer}.tar easzlab/pause-amd64:${pauseVer} /bin/cp -u "${imageDir}/pause_${pauseVer}.tar" "${imageDir}/pause.tar" fi - if [[ ! -f "$imageDir/traefik_$traefikVer.tar" ]];then - docker pull traefik:${traefikVer} && \ - docker save -o ${imageDir}/traefik_${traefikVer}.tar traefik:${traefikVer} - fi if [[ ! -f "$imageDir/kubeasz_$KUBEASZ_VER.tar" ]];then docker pull easzlab/kubeasz:${KUBEASZ_VER} && \ docker save -o ${imageDir}/kubeasz_${KUBEASZ_VER}.tar easzlab/kubeasz:${KUBEASZ_VER}