This document walks through the recommended steps to be followed when upgrading Docker on nodes that are part of Kubernetes cluster created by Rancher on the following 2 types of cluster:
- Clusters created by Rancher by bringing your own nodes, i.e. creating a custom cluster through the UI, that are hosted in any infrastructure provider or in on-premise bare metal servers.
- Clusters created by Rancher on nodes that are deployed by Rancher using an infrastructure provider like Amazon EC2, Azure, vSphere, DigitalOcean.
Before you start upgrading the Docker version on worker nodes, we highly recommend adding at least one additional worker node to help facilitate the draining of Docker containers during the upgrade process.
Steps to be followed when upgrading Docker version on the worker nodes:
-
Drain worker node to migrate all workloads to other existing worker nodes.
-
In Rancher v2.0.x, execute
kubectl drain --ignore-daemonsets <node-name>
using your kubectl. Note: Do not use kubectl shell provided by rancher as this shell can be stopped as part of the draining process. Wait for kubectl command to complete successfully. -
In Rancher v2.1.x, use the
Drain
option provided for the worker node in UI. Leave the default option: "Even if there are DaemonSet-managed pods" selected. Wait for the status of the node to get toDrained
state.
-
-
Upgrade Docker version on the node by following upgrade instructions specific to the OS version of the nodes.
-
Uncordon the node using
uncordon
option for the worker node in UI -
Wait for work node to get to
Active
state.
Follow the above steps for all the worker nodes.
Before you start upgrading etcd nodes, it is highly recommend you backup etcd. There is no need for removing the etcd node from cluster when upgrading the Docker version.
- Upgrade the Docker version on the etcd node ONE at a time. Do NOT attempt upgrading Docker version on more than 1 etcd node at the same time.
- Once Docker is upgraded on the etcd node, verify quorum is up and etcd is healthy .This can be checked by executing the following command from
etcd
container on any of the etcd nodes -etcdctl --endpoints=https://<node-ip>:2379 member list
.
Upgrade the Docker version on the control nodes ONE at a time. Do NOT attempt upgrading the Docker version on more than 1 control node at the same time.
As we have the ability to create node pools with the desired Docker version, we recommend creating a new node pool with the new Docker version and replace the existing node pool in the cluster instead of having to upgrade the Docker version in each of the nodes in the cluster.
As part of this upgrade process, you will be guided through the process of creating a new worker pool and adding this pool to the cluster before deleting the existing worker pool.
- Create a new worker node template with same value as existing worker node template except that the “Docker Install Url” should point to the new Docker version . This option will be present under “Engine Options” section. User can choose to use the “Clone” option to achieve this.
- Navigate to (Cluster Name) -> Nodes.
- Edit the cluster and use the
Add Node Pool
option to create a new worker pool (choose a different name from the existing worker pool) with same count as the count on the existing worker pool you want to upgrade and the template that was created in step 1. - Wait for all the new nodes in the pool to become active.
- Select all nodes in old worker pool.
- Cordon all nodes in old worker pool.
- Drain all nodes in old worker pool.
- In Rancher v2.0.x, execute
kubectl drain --ignore-daemonsets <node-name>
using your kubectl. Note: Do not use kubectl shell provided by rancher as this shell can be stopped as part of the draining process. - In Rancher v2.1.x, use the
Drain
option provided for the worker node in UI. Leave the default option: "Even if there are DaemonSet-managed pods" selected.
- In Rancher v2.0.x, execute
- Once all nodes in the old pool are in the drained state, delete the pool.
As part of this upgrade process, you will be guided through the process of updating the existing node templates that the existing control/etcd node pool is using.
- Before you start upgrading etcd nodes, it is highly recommend that you backup etcd.
- Update template that the etcd/control plane pool by changing the "Docker Install Url” option that is present under “Engine Options” section to point to the new Docker version.
- Before proceeding to deleting nodes, make sure that you have at least 2 control nodes and 3 etcd nodes.
- Navigate to (Cluster Name) -> Nodes.
- Delete one node in the etcd/control plane pool. Node will automatically get recreated.
- Wait for node to create and transition to
Active
state. - In case of etcd nodes, make sure that etcd continues to be healthy and reports correct members. This can be checked by executing the following command from
etcd
container on any of the etcd nodes -etcdctl --endpoints=https://<node-ip>:2379 member list
. - Wait for all cluster updating actions to finish (red box at the top of the screen) and the cluster get to
Active
state. - Repeat steps 4-8 for each etcd/control plane node.