kubeasz/playbooks/93.upgrade.yml

43 lines
1.0 KiB
YAML
Raw Permalink Normal View History

# WARNING: Upgrade the k8s cluster can be risky. Make sure you know what you are doing.
# Read the guide: 'op/upgrade.md' .
2021-01-07 09:30:50 +08:00
# Usage: ezctl upgrade <cluster_name>
# check k8s version
- hosts: kube_master
2021-01-07 09:30:50 +08:00
tasks:
- name: get running k8s version
shell: "{{ bin_dir }}/kube-apiserver --version"
register: RUNNING_VER
run_once: true
- name: print running version
debug: var="RUNNING_VER.stdout"
run_once: true
- name: get update version
shell: "{{ base_dir }}/bin/kube-apiserver --version"
register: UPDATE_VER
run_once: true
connection: local
- name: print update version
debug: var="UPDATE_VER.stdout"
run_once: true
- name: check version
fail: msg="running version is the same as the update version, UPDATE ABORT."
when: "RUNNING_VER.stdout == UPDATE_VER.stdout"
2018-05-11 11:07:14 +08:00
# update masters
2018-08-12 19:53:04 +08:00
- hosts:
- kube_master
2018-05-11 11:07:14 +08:00
roles:
- kube-master
- kube-node
# update nodes
2018-08-12 19:53:04 +08:00
- hosts:
- kube_node
2018-05-11 11:07:14 +08:00
roles:
- { role: kube-node, when: "inventory_hostname not in groups['kube_master']" }