diff --git a/manifests/dashboard/kubernetes-dashboard.yaml b/manifests/dashboard/kubernetes-dashboard.yaml index ebb82e4..af07c2b 100644 --- a/manifests/dashboard/kubernetes-dashboard.yaml +++ b/manifests/dashboard/kubernetes-dashboard.yaml @@ -189,8 +189,7 @@ spec: spec: containers: - name: kubernetes-dashboard - image: kubernetesui/dashboard:v2.0.0-rc3 - + image: kubernetesui/dashboard:v2.0.1 ports: - containerPort: 8443 protocol: TCP @@ -226,8 +225,6 @@ spec: - name: tmp-volume emptyDir: {} serviceAccountName: kubernetes-dashboard - nodeSelector: - "beta.kubernetes.io/os": linux # Comment the following tolerations if Dashboard must not be deployed on master tolerations: - key: node-role.kubernetes.io/master @@ -273,7 +270,7 @@ spec: spec: containers: - name: dashboard-metrics-scraper - image: kubernetesui/metrics-scraper:v1.0.3 + image: kubernetesui/metrics-scraper:v1.0.4 ports: - containerPort: 8000 protocol: TCP @@ -293,8 +290,6 @@ spec: runAsUser: 1001 runAsGroup: 2001 serviceAccountName: kubernetes-dashboard - nodeSelector: - "beta.kubernetes.io/os": linux # Comment the following tolerations if Dashboard must not be deployed on master tolerations: - key: node-role.kubernetes.io/master diff --git a/roles/cluster-addon/defaults/main.yml b/roles/cluster-addon/defaults/main.yml index 8bec89c..6a5d52d 100644 --- a/roles/cluster-addon/defaults/main.yml +++ b/roles/cluster-addon/defaults/main.yml @@ -21,7 +21,7 @@ metricsserver_offline: "metrics-server_{{ metricsVer }}.tar" # dashboard 自动安装 # dashboard v2.x.x 不依赖于heapster dashboard_install: "yes" -dashboardVer: "v2.0.0" +dashboardVer: "v2.0.1" dashboard_offline: "dashboard_{{ dashboardVer }}.tar" dashboardMetricsScraperVer: "v1.0.4" metricsscraper_offline: "metrics-scraper_{{ dashboardMetricsScraperVer }}.tar" diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 42247e8..60d239c 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -1,15 +1,10 @@ +- name: 获取是否已经安装docker + shell: 'systemctl status docker|grep Active || echo "NoFound"' + register: docker_svc + - name: 获取是否已经安装containerd - shell: 'systemctl status containerd|grep Active || echo "NOT FOUND"' - register: containerd_status - -- name: fail info1 - fail: msg="Containerd already installed!" - when: '"running" in containerd_status.stdout' - -- name: 获取是否运行名为'kubeasz'的容器 - shell: 'systemctl status docker|grep Active && docker ps|grep kubeasz || echo "NOT FOUND"' - register: install_info - tags: upgrade_docker, download_docker + shell: 'systemctl status containerd|grep Active || echo "NoFound"' + register: containerd_svc # 18.09.x 版本二进制名字有变化,需要做判断 - name: 获取docker版本信息 @@ -104,4 +99,4 @@ - name: 配置 docker 命令软链接 file: src={{ bin_dir }}/docker dest=/usr/bin/docker state=link ignore_errors: true - when: "'kubeasz' not in install_info.stdout" + when: "'running' not in containerd_svc.stdout and 'running' not in docker_svc.stdout" diff --git a/tools/easzup b/tools/easzup index b36a80e..7af6bdc 100755 --- a/tools/easzup +++ b/tools/easzup @@ -15,25 +15,22 @@ set -o errexit # default version, can be overridden by cmd line options export DOCKER_VER=19.03.8 -export KUBEASZ_VER=2.3.0 +export KUBEASZ_VER=2.2.0 export K8S_BIN_VER=v1.18.3 -export EXT_BIN_VER=0.5.0 +export EXT_BIN_VER=0.5.2 export SYS_PKG_VER=0.3.3 -function install_docker() { - # check if a container runtime is already installed - systemctl status docker|grep Active|grep -q running && { echo "[WARN] docker is already running."; return 0; } - systemctl status containerd|grep Active|grep -q running && { echo "[ERROR] containerd is running, unsupported."; exit 1; } - - which docker && { echo "[WARN] docker is installed."; systemctl restart docker; return 0; } - +function download_docker() { + [[ -f "/etc/ansible/bin/dockerd" ]] && { echo "[WARN] docker is downloaded."; return 0; } + + echo -e "[INFO] \033[33mdownloading docker binaries\033[0m $DOCKER_VER" if [[ "$REGISTRY_MIRROR" == CN ]];then DOCKER_URL="https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/static/stable/x86_64/docker-${DOCKER_VER}.tgz" else DOCKER_URL="https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VER}.tgz" fi - mkdir -p /opt/kube/bin /etc/docker /etc/ansible/down + mkdir -p /opt/kube/bin /etc/ansible/down /etc/ansible/bin if [[ -f "/etc/ansible/down/docker-${DOCKER_VER}.tgz" ]];then echo "[INFO] docker binaries already existed" else @@ -43,12 +40,20 @@ function install_docker() { else wget -c "$DOCKER_URL" || { echo "[ERROR] downloading docker failed"; exit 1; } fi - mv ./docker-${DOCKER_VER}.tgz /etc/ansible/down + /bin/mv -f ./docker-${DOCKER_VER}.tgz /etc/ansible/down fi tar zxf /etc/ansible/down/docker-${DOCKER_VER}.tgz -C /etc/ansible/down && \ - mv /etc/ansible/down/docker/* /opt/kube/bin && \ + /bin/cp -f /etc/ansible/down/docker/* /etc/ansible/bin && \ + /bin/mv -f /etc/ansible/down/docker/* /opt/kube/bin && \ ln -sf /opt/kube/bin/docker /bin/docker +} + +function install_docker() { + # check if a container runtime is already installed + systemctl status docker|grep Active|grep -q running && { echo "[WARN] docker is already running."; return 0; } + + which docker && { echo "[WARN] docker is installed."; systemctl restart docker; return 0; } echo "[INFO] generate docker service file" cat > /etc/systemd/system/docker.service << EOF @@ -72,6 +77,7 @@ WantedBy=multi-user.target EOF # configuration for dockerd + mkdir -p /etc/docker echo "[INFO] generate docker config file" if [[ "$REGISTRY_MIRROR" == CN ]];then echo "[INFO] prepare register mirror for $REGISTRY_MIRROR" @@ -126,7 +132,7 @@ function get_kubeasz() { echo "[INFO] run a temporary container" docker run -d --name temp_easz easzlab/kubeasz:${KUBEASZ_VER} || { echo "[ERROR] download failed."; exit 1; } - [[ -f "/etc/ansible/down/docker-${DOCKER_VER}.tgz" ]] && mv "/etc/ansible/down/docker-${DOCKER_VER}.tgz" /tmp + [[ -f "/etc/ansible/down/docker-${DOCKER_VER}.tgz" ]] && /bin/mv -f "/etc/ansible/down/docker-${DOCKER_VER}.tgz" /tmp rm -rf /etc/ansible && \ echo "[INFO] cp kubeasz code from the temporary container" && \ @@ -134,7 +140,8 @@ function get_kubeasz() { echo "[INFO] stop&remove temporary container" && \ docker rm -f temp_easz - [[ -f "/tmp/docker-${DOCKER_VER}.tgz" ]] && mv "/tmp/docker-${DOCKER_VER}.tgz" /etc/ansible/down + [[ -f "/tmp/docker-${DOCKER_VER}.tgz" ]] && /bin/mv -f "/tmp/docker-${DOCKER_VER}.tgz" /etc/ansible/down + [[ -d "/opt/kube/bin" ]] && /bin/mv -f "/opt/kube/bin/*" /etc/ansible/bin return 0 } @@ -147,7 +154,7 @@ function get_k8s_bin() { docker run -d --name temp_k8s_bin easzlab/kubeasz-k8s-bin:${K8S_BIN_VER} && \ echo "[INFO] cp k8s binaries" && \ docker cp temp_k8s_bin:/k8s /k8s_bin_tmp && \ - mv /k8s_bin_tmp/* /etc/ansible/bin && \ + /bin/mv -f /k8s_bin_tmp/* /etc/ansible/bin && \ echo "[INFO] stop&remove temporary container" && \ docker rm -f temp_k8s_bin && \ rm -rf /k8s_bin_tmp @@ -162,7 +169,7 @@ function get_ext_bin() { docker run -d --name temp_ext_bin easzlab/kubeasz-ext-bin:${EXT_BIN_VER} && \ echo "[INFO] cp extral binaries" && \ docker cp temp_ext_bin:/extra /extra_bin_tmp && \ - mv /extra_bin_tmp/* /etc/ansible/bin && \ + /bin/mv -f /extra_bin_tmp/* /etc/ansible/bin && \ echo "[INFO] stop&remove temporary container" && \ docker rm -f temp_ext_bin && \ rm -rf /extra_bin_tmp @@ -185,7 +192,7 @@ function get_offline_image() { # images needed by k8s cluster calicoVer=v3.8.8 corednsVer=1.6.7 - dashboardVer=v2.0.0 + dashboardVer=v2.0.1 dashboardMetricsScraperVer=v1.0.4 flannelVer=v0.12.0-amd64 metricsVer=v0.3.6 @@ -234,11 +241,11 @@ function get_offline_image() { } function download_all() { + download_docker && \ install_docker && \ get_kubeasz && \ get_k8s_bin && \ get_ext_bin && \ - get_sys_pkg && \ get_offline_image } @@ -292,6 +299,7 @@ Usage: easzup [options] [args] option: -{DdekSz} -C stop&clean all local containers -D download all into /etc/ansible + -P download system packages for offline installing -S start kubeasz in a container -d set docker-ce version, default "$DOCKER_VER" -e set kubeasz-ext-bin version, default "$EXT_BIN_VER" @@ -315,7 +323,7 @@ function main() { export REGISTRY_MIRROR="CN" ACTION="" - while getopts "CDSd:e:k:m:p:z:" OPTION; do + while getopts "CDPSd:e:k:m:p:z:" OPTION; do case "$OPTION" in C) ACTION="clean_container" @@ -323,6 +331,9 @@ function main() { D) ACTION="download_all" ;; + P) + ACTION="get_sys_pkg" + ;; S) ACTION="start_kubeasz_docker" ;;