diff --git a/roles/kubernetes/master/tasks/kubeadm-upgrade.yml b/roles/kubernetes/master/tasks/kubeadm-upgrade.yml index 448a71baa..fcd197ae4 100644 --- a/roles/kubernetes/master/tasks/kubeadm-upgrade.yml +++ b/roles/kubernetes/master/tasks/kubeadm-upgrade.yml @@ -1,4 +1,14 @@ --- +- name: kubeadm | Check api is up + uri: + url: "https://{{ ip | default(fallback_ips[inventory_hostname]) }}:6443/healthz" + validate_certs: false + when: inventory_hostname == groups['kube-master']|first + register: _result + retries: 60 + delay: 5 + until: _result.status == 200 + - name: kubeadm | Upgrade first master command: >- timeout -k 600s 600s diff --git a/upgrade-cluster.yml b/upgrade-cluster.yml index a20b1ec88..c0c256283 100644 --- a/upgrade-cluster.yml +++ b/upgrade-cluster.yml @@ -30,14 +30,22 @@ - { role: kubespray-defaults} - { role: bootstrap-os, tags: bootstrap-os} -- hosts: k8s-cluster:etcd:calico-rr +- name: Prepare nodes for upgrade + hosts: k8s-cluster:etcd:calico-rr + any_errors_fatal: "{{ any_errors_fatal | default(true) }}" + roles: + - { role: kubespray-defaults} + - { role: kubernetes/preinstall, tags: preinstall } + - { role: download, tags: download, when: "not skip_downloads" } + environment: "{{ proxy_env }}" + +- name: Upgrade container engine on non-cluster nodes + hosts: etcd:calico-rr:!k8s-cluster any_errors_fatal: "{{ any_errors_fatal | default(true) }}" serial: "{{ serial | default('20%') }}" roles: - { role: kubespray-defaults} - - { role: kubernetes/preinstall, tags: preinstall } - { role: container-engine, tags: "container-engine", when: deploy_container_engine|default(true) } - - { role: download, tags: download, when: "not skip_downloads" } environment: "{{ proxy_env }}" - hosts: etcd @@ -69,6 +77,7 @@ roles: - { role: kubespray-defaults} - { role: upgrade/pre-upgrade, tags: pre-upgrade } + - { role: container-engine, tags: "container-engine", when: deploy_container_engine|default(true) } - { role: kubernetes/node, tags: node } - { role: kubernetes/master, tags: master, upgrade_cluster_setup: true } - { role: kubernetes/client, tags: client } @@ -94,6 +103,7 @@ roles: - { role: kubespray-defaults} - { role: upgrade/pre-upgrade, tags: pre-upgrade } + - { role: container-engine, tags: "container-engine", when: deploy_container_engine|default(true) } - { role: kubernetes/node, tags: node } - { role: kubernetes/kubeadm, tags: kubeadm } - { role: kubernetes/node-label, tags: node-label }