Skip to content

Commit

Permalink
feat: update version.
Browse files Browse the repository at this point in the history
  • Loading branch information
lework committed Feb 23, 2021
1 parent 681b07b commit c789591
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 44 deletions.
64 changes: 35 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,16 @@ MEM: `4G`
| common | [docker-ce](https://github.com/docker/docker-ce) | latest | ![docker-ce release](https://img.shields.io/github/v/release/docker/docker-ce?sort=semver) |
| common | [kubernetes](https://github.com/kubernetes/kubernetes) | latest | ![kubernetes release](https://img.shields.io/github/v/release/kubernetes/kubernetes?sort=semver) |
| network | [flannel](https://github.com/coreos/flannel) | 0.13.0 | ![flannel release](https://img.shields.io/github/v/release/coreos/flannel) |
| network | [calico](https://github.com/projectcalico/calico) | 3.17.1 | ![calico release ](https://img.shields.io/github/v/release/projectcalico/calico?sort=semver) |
| addons | [metrics server](https://github.com/kubernetes-sigs/metrics-server) | 0.4.1 | ![metrics-server release](https://img.shields.io/github/v/release/kubernetes-sigs/metrics-server) |
| network | [calico](https://github.com/projectcalico/calico) | 3.18.0 | ![calico release ](https://img.shields.io/github/v/release/projectcalico/calico?sort=semver) |
| addons | [metrics server](https://github.com/kubernetes-sigs/metrics-server) | 0.4.2 | ![metrics-server release](https://img.shields.io/github/v/release/kubernetes-sigs/metrics-server) |
| addons | [nodelocaldns](https://github.com/kubernetes/dns/tree/master/cmd/node-cache) | 1.16.0 | 1.16.0 |
| ingress | [ingress nginx controller](https://github.com/kubernetes/ingress-nginx) | 0.43.0 | ![ingress-nginx release](https://img.shields.io/github/v/release/kubernetes/ingress-nginx?sort=semver) |
| ingress | [traefik](https://github.com/traefik/traefik) | 2.3.7 | ![traefik release ](https://img.shields.io/github/v/release/traefik/traefik?sort=semver) |
| ingress | [ingress nginx controller](https://github.com/kubernetes/ingress-nginx) | 0.44.0 | ![ingress-nginx release](https://img.shields.io/github/v/release/kubernetes/ingress-nginx?sort=semver) |
| ingress | [traefik](https://github.com/traefik/traefik) | 2.4.5 | ![traefik release ](https://img.shields.io/github/v/release/traefik/traefik?sort=semver) |
| monitor | [kube_prometheus](https://github.com/prometheus-operator/kube-prometheus) | 0.7.0 | ![kube-prometheus release](https://img.shields.io/github/v/release/prometheus-operator/kube-prometheus) |
| log | [elasticsearch](https://github.com/elastic/elasticsearch) | 7.10.2 | ![elasticsearch release](https://img.shields.io/github/v/release/elastic/elasticsearch?sort=semver) |
| storage | [rook](https://github.com/rook/rook) | 1.5.5 | ![rook release](https://img.shields.io/github/v/release/rook/rook?sort=semver) |
| log | [elasticsearch](https://github.com/elastic/elasticsearch) | 7.11.1 | ![elasticsearch release](https://img.shields.io/github/v/release/elastic/elasticsearch?sort=semver) |
| storage | [rook](https://github.com/rook/rook) | 1.5.7 | ![rook release](https://img.shields.io/github/v/release/rook/rook?sort=semver) |
| storage | [longhorn](https://github.com/longhorn/longhorn) | 1.1.0 | ![longhorn release](https://img.shields.io/github/v/release/longhorn/longhorn?sort=semver) |
| ui | [kubernetes_dashboard](https://github.com/kubernetes/dashboard) | 2.1.0 | ![kubernetes dashboard release](https://img.shields.io/github/v/release/kubernetes/dashboard?sort=semver) |
| ui | [kubernetes_dashboard](https://github.com/kubernetes/dashboard) | 2.2.0 | ![kubernetes dashboard release](https://img.shields.io/github/v/release/kubernetes/dashboard?sort=semver) |
| ui | [kubesphere](https://github.com/kubesphere/kubesphere) | 3.0.0 | ![kubesphere release](https://img.shields.io/github/v/release/kubesphere/kubesphere?sort=semver) |

**kube组件** 版本可以通过参数(`--version`) 指定外,其他的软件版本需在脚本中指定。
Expand Down Expand Up @@ -142,7 +142,7 @@ Example:
--worker 192.168.77.133,192.168.77.134,192.168.77.135 \
--user root \
--password 123456 \
--version 1.19.3
--version 1.20.4

[reset cluster]
kainstall.sh reset \
Expand All @@ -155,7 +155,7 @@ Example:
--worker 192.168.77.143,192.168.77.144 \
--user root \
--password 123456 \
--version 1.19.3
--version 1.20.4

[del node]
kainstall.sh del \
Expand All @@ -166,7 +166,7 @@ Example:

[other]
kainstall.sh renew-cert --user root --password 123456
kainstall.sh upgrade --version 1.19.3 --user root --password 123456
kainstall.sh upgrade --version 1.20.4 --user root --password 123456
kainstall.sh update
kainstall.sh add --ingress traefik
kainstall.sh add --monitor prometheus
Expand All @@ -186,15 +186,15 @@ bash kainstall.sh init \
--user root \
--password 123456 \
--port 22 \
--version 1.20.1
--version 1.20.4

# 使用环境变量
export MASTER_NODES="192.168.77.130,192.168.77.131,192.168.77.132"
export WORKER_NODES="192.168.77.133,192.168.77.134"
export SSH_USER="root"
export SSH_PASSWORD="123456"
export SSH_PORT="22"
export KUBE_VERSION="1.20.1"
export KUBE_VERSION="1.20.4"
bash kainstall.sh init
```

Expand All @@ -210,7 +210,7 @@ bash -c "$(curl -sSL https://cdn.jsdelivr.net/gh/lework/kainstall@master/kainsta
--user root \
--password 123456 \
--port 22 \
--version 1.20.1
--version 1.20.4
```

### 增加节点
Expand Down Expand Up @@ -274,7 +274,7 @@ bash kainstall.sh add --storage rook
bash kainstall.sh add --addon nodelocaldns

# 升级版本
bash kainstall.sh upgrade --version 1.20.1
bash kainstall.sh upgrade --version 1.20.4

# 重新颁发证书
bash kainstall.sh renew-cert
Expand All @@ -295,16 +295,16 @@ bash kainstall.sh update
DOCKER_VERSION="${DOCKER_VERSION:-latest}"
KUBE_VERSION="${KUBE_VERSION:-latest}"
FLANNEL_VERSION="${FLANNEL_VERSION:-0.13.0}"
METRICS_SERVER_VERSION="${METRICS_SERVER_VERSION:-0.4.1}"
INGRESS_NGINX="${INGRESS_NGINX:-0.43.0}"
TRAEFIK_VERSION="${TRAEFIK_VERSION:-2.3.7}"
CALICO_VERSION="${CALICO_VERSION:-3.17.1}"
METRICS_SERVER_VERSION="${METRICS_SERVER_VERSION:-0.4.2}"
INGRESS_NGINX="${INGRESS_NGINX:-0.44.0}"
TRAEFIK_VERSION="${TRAEFIK_VERSION:-2.4.5}"
CALICO_VERSION="${CALICO_VERSION:-3.18.0}"
KUBE_PROMETHEUS_VERSION="${KUBE_PROMETHEUS_VERSION:-0.7.0}"
ELASTICSEARCH_VERSION="${ELASTICSEARCH_VERSION:-7.10.2}"
ROOK_VERSION="${ROOK_VERSION:-1.5.5}"
ELASTICSEARCH_VERSION="${ELASTICSEARCH_VERSION:-7.11.1}"
ROOK_VERSION="${ROOK_VERSION:-1.5.7}"
LONGHORN_VERSION="${LONGHORN_VERSION:-1.1.0}"
KUBERNETES_DASHBOARD_VERSION="${KUBERNETES_DASHBOARD_VERSION:-2.1.0}"
KUBESPHERE_VERSION="${KUBESPHERE_VERSION:-3.0.0}"
KUBERNETES_DASHBOARD_VERSION="${KUBERNETES_DASHBOARD_VERSION:-2.2.0}"
KUBESPHERE_VERSION="${KUBESPHERE_VERSION:-3.0.0}"

# 集群配置
KUBE_DNSDOMAIN="${KUBE_DNSDOMAIN:-cluster.local}"
Expand Down Expand Up @@ -352,7 +352,7 @@ SKIP_UPGRADE_PLAN=${SKIP_UPGRADE_PLAN:-false}
1. 下载指定版本的离线包

```bash
wget http://kainstall.oss-cn-shanghai.aliyuncs.com/1.20.1/centos7.tgz
wget http://kainstall.oss-cn-shanghai.aliyuncs.com/1.20.4/centos7.tgz
```

> 更多离线包信息,见 [kainstall-offline](https://github.com/lework/kainstall-offline) 仓库
Expand All @@ -365,7 +365,11 @@ SKIP_UPGRADE_PLAN=${SKIP_UPGRADE_PLAN:-false}
bash kainstall.sh init \
--master 192.168.77.130,192.168.77.131,192.168.77.132 \
--worker 192.168.77.133,192.168.77.134 \
--version 1.20.1 \
--user root \
--password 123456 \
--version 1.20.4 \
--upgrade-kernel \
--10years \
--offline-file centos7.tgz
```

Expand All @@ -377,7 +381,9 @@ SKIP_UPGRADE_PLAN=${SKIP_UPGRADE_PLAN:-false}
bash kainstall.sh add \
--master 192.168.77.135 \
--worker 192.168.77.136 \
--version 1.20.1 \
--user root \
--password 123456 \
--version 1.20.4 \
--offline-file centos7.tgz
```

Expand Down Expand Up @@ -407,7 +413,7 @@ bash kainstall.sh init \
--user test \
--password 12345678 \
--port 22 \
--version 1.20.1 \
--version 1.20.4 \
--sudo \
--sudo-user root \
--sudo-password 12345678
Expand All @@ -419,7 +425,7 @@ bash kainstall.sh add \
--user test \
--password 12345678 \
--port 22 \
--version 1.20.1 \
--version 1.20.4 \
--sudo \
--sudo-user root \
--sudo-password 12345678
Expand All @@ -446,7 +452,7 @@ bash kainstall.sh init \
--user root \
--password 123456 \
--port 22 \
--version 1.20.1 \
--version 1.20.4 \
--10years
# 添加
Expand All @@ -456,7 +462,7 @@ bash kainstall.sh add \
--user root \
--password 123456 \
--port 22 \
--version 1.20.1 \
--version 1.20.4 \
--10years
```

Expand Down
33 changes: 18 additions & 15 deletions kainstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ set -o pipefail # Use last non-zero exit code in a pipeline
DOCKER_VERSION="${DOCKER_VERSION:-latest}"
KUBE_VERSION="${KUBE_VERSION:-latest}"
FLANNEL_VERSION="${FLANNEL_VERSION:-0.13.0}"
METRICS_SERVER_VERSION="${METRICS_SERVER_VERSION:-0.4.1}"
INGRESS_NGINX="${INGRESS_NGINX:-0.43.0}"
TRAEFIK_VERSION="${TRAEFIK_VERSION:-2.3.7}"
CALICO_VERSION="${CALICO_VERSION:-3.17.1}"
METRICS_SERVER_VERSION="${METRICS_SERVER_VERSION:-0.4.2}"
INGRESS_NGINX="${INGRESS_NGINX:-0.44.0}"
TRAEFIK_VERSION="${TRAEFIK_VERSION:-2.4.5}"
CALICO_VERSION="${CALICO_VERSION:-3.18.0}"
KUBE_PROMETHEUS_VERSION="${KUBE_PROMETHEUS_VERSION:-0.7.0}"
ELASTICSEARCH_VERSION="${ELASTICSEARCH_VERSION:-7.10.2}"
ROOK_VERSION="${ROOK_VERSION:-1.5.5}"
ELASTICSEARCH_VERSION="${ELASTICSEARCH_VERSION:-7.11.1}"
ROOK_VERSION="${ROOK_VERSION:-1.5.7}"
LONGHORN_VERSION="${LONGHORN_VERSION:-1.1.0}"
KUBERNETES_DASHBOARD_VERSION="${KUBERNETES_DASHBOARD_VERSION:-2.1.0}"
KUBERNETES_DASHBOARD_VERSION="${KUBERNETES_DASHBOARD_VERSION:-2.2.0}"
KUBESPHERE_VERSION="${KUBESPHERE_VERSION:-3.0.0}"

# 集群配置
Expand Down Expand Up @@ -100,8 +100,8 @@ function trap::info() {
function log::err() {
# 错误日志

local item; item="[$(date +'%Y-%m-%dT%H:%M:%S.%N%z')]: \033[31mERROR: \033[0m$*\n"
ERROR_INFO="${ERROR_INFO}${item} "
local item; item="[$(date +'%Y-%m-%dT%H:%M:%S.%N%z')]: \033[31mERROR: \033[0m$*"
ERROR_INFO="${ERROR_INFO}${item}\n "
echo -e "${item}" | tee -a "$LOG_FILE"
}

Expand Down Expand Up @@ -1869,6 +1869,7 @@ function add::ingress() {
kube::apply "${ingress_nginx_file}"
kube::wait "ingress-nginx" "ingress-nginx" "pod" "app.kubernetes.io/component=controller" && add_ingress_demo=1
sleep 10
elif [[ "$KUBE_INGRESS" == "traefik" ]]; then
log::info "[ingress]" "add ingress-traefik"
Expand Down Expand Up @@ -2107,7 +2108,7 @@ spec:
spec:
containers:
- name: whoami
image: traefik/whoami:v1.6.0
image: traefik/whoami:v1.6.1
ports:
- containerPort: 80
---
Expand Down Expand Up @@ -2242,11 +2243,12 @@ function add::monitor() {
command::exec "${MGMT_NODE}" "
$(declare -f utils::retry)
cd \"${OFFLINE_DIR}/manifests/kube-prometheus-${KUBE_PROMETHEUS_VERSION}\" \
&& utils::retry 6 kubectl apply -f manifests/setup/ \
&& utils::retry 6 kubectl apply --wait=true --timeout=10s -f manifests/setup/ \
&& until kubectl get servicemonitors --all-namespaces ; do date; sleep 1; echo ''; done \
&& utils::retry 6 kubectl apply -f manifests/
&& utils::retry 6 kubectl apply --wait=true --timeout=10s -f manifests/
"
check::exit_code "$?" "apply" "add prometheus"
kube::wait "prometheus" "monitoring" "pods --all"
kube::apply "controller-manager and scheduler prometheus discovery service" "
---
Expand Down Expand Up @@ -2624,6 +2626,7 @@ spec:
"
# shellcheck disable=SC2181
if [[ "$?" == "0" ]]; then
kube::wait "elasticsearch" "kube-logging" "pods --all"
get::ingress_conn
log::access "[ingress]" "curl -H 'Host:kibana.logging.cluster.local' http://${INGRESS_CONN}"
log::access "[ingress]" "curl -H 'Host:elasticsearch.logging.cluster.local' http://${INGRESS_CONN}"
Expand Down Expand Up @@ -3330,7 +3333,7 @@ Example:
--worker 192.168.77.133,192.168.77.134,192.168.77.135 \\
--user root \\
--password 123456 \\
--version 1.19.3
--version 1.20.4
[reset cluster]
$0 reset \\
Expand All @@ -3343,7 +3346,7 @@ Example:
--worker 192.168.77.143,192.168.77.144 \\
--user root \\
--password 123456 \\
--version 1.19.3
--version 1.20.4
[del node]
$0 del \\
Expand All @@ -3354,7 +3357,7 @@ Example:
[other]
$0 renew-cert --user root --password 123456
$0 upgrade --version 1.19.3 --user root --password 123456
$0 upgrade --version 1.20.4 --user root --password 123456
$0 update
$0 add --ingress traefik
$0 add --monitor prometheus
Expand Down

0 comments on commit c789591

Please sign in to comment.