Skip to content

Commit

Permalink
更新集群升级操作说明及脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
gjmzj committed Sep 11, 2018
1 parent cdf778b commit 867cc21
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
5 changes: 2 additions & 3 deletions docs/op/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ $ ETCDCTL_API=3 etcdctl --write-out=table snapshot status backup.db
- 3a.如果不需要升级 docker版本:执行 `ansible-playbook -t upgrade_k8s 22.upgrade.yml` 即可完成k8s 升级,不会中断业务应用
- 注:确实不需要频繁去升级 docker

- 3b.如果可以接受短暂业务中断,执行 `ansible-playbook -t upgrade_k8s,restart_dockerd 22.upgrade.yml` 即可升级 k8s和 docker(如果有新的docker二进制)
- 3b.如果可以接受短暂业务中断,执行 `ansible-playbook -t upgrade_k8s,upgrade_docker 22.upgrade.yml` 即可升级 k8s和 docker(如果有新的docker二进制)

- 3c.如果要求零中断升级 k8s和 docker
- i 执行 `ansible-playbook -t upgrade_k8s 22.upgrade.yml` (该步骤不会影响k8s上的业务应用)
- i 执行 `ansible-playbook -t upgrade_k8s,download_docker 22.upgrade.yml` (该步骤不会影响k8s上的业务应用)
- ii 逐个升级重启每个node节点的dockerd服务
- 待重启节点,先应用`kubectl cordon``kubectl drain`命令迁移业务pod
- 待重启节点执行 `systemctl restart docker`
- 恢复节点可调度 `kubectl uncordon`

2 changes: 1 addition & 1 deletion down/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#主要组件版本如下
export K8S_VER=v1.10.2
export ETCD_VER=v3.3.8
export DOCKER_VER=18.03.1-ce
export DOCKER_VER=17.03.2-ce
export CNI_VER=v0.7.0
export DOCKER_COMPOSE=1.18.0
export HARBOR=v1.2.2
Expand Down
7 changes: 3 additions & 4 deletions roles/docker/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
- docker-containerd-ctr
- dockerd
- docker-proxy
tags: upgrade_k8s
tags: upgrade_docker, download_docker

- name: docker命令自动补全
copy: src=docker dest=/etc/bash_completion.d/docker mode=0644
Expand All @@ -32,18 +32,17 @@

- name: 创建docker的systemd unit文件
template: src=docker.service.j2 dest=/etc/systemd/system/docker.service
tags: upgrade_k8s
tags: upgrade_docker, download_docker

- name: 开机启用docker 服务
shell: systemctl enable docker
ignore_errors: true

- name: 开启docker 服务
shell: systemctl daemon-reload && systemctl restart docker
tags: restart_dockerd
tags: upgrade_docker

## 可选 ------安装docker查询镜像 tag的小工具----
# 先要安装轻量JSON处理程序‘jq’,已在 prepare 节点安装
- name: 下载 docker-tag
copy: src=docker-tag dest={{ bin_dir }}/docker-tag mode=0755
tags: docker-tag

0 comments on commit 867cc21

Please sign in to comment.