Upgrading the Kubernetes Version on Worker Nodes in a Cluster
You can upgrade the version of Kubernetes running on the worker nodes in a cluster in the following ways:
- Perform an 'in-place' upgrade, by specifying a more recent Kubernetes version for new worker nodes starting in the existing node pool, and then cycling the nodes to automatically replace all existing worker nodes. First, you modify the existing node pool's properties to specify the more recent Kubernetes version. Then, you cycle the nodes in the node pool, specifying both a maximum allowed number of new nodes that can be created during the operation, and a maximum allowed number of nodes that can be unavailable. Container Engine for Kubernetes automatically cordons, drains, and terminates existing worker nodes, and creates new worker nodes. When new worker nodes are started in the existing node pool, they run the more recent Kubernetes version you specified. See Performing an In-Place Worker Node Kubernetes Upgrade by Cycling Nodes in an Existing Node Pool.
- Perform an 'in-place' upgrade, by specifying a more recent Kubernetes version for new worker nodes starting in the existing node pool, and then manually replacing each existing worker node with a new worker node. First, you modify the existing node pool's properties to specify the more recent Kubernetes version. Then, you delete each worker node in turn, selecting appropriate cordon and drain options to prevent new pods starting and to delete existing pods. You start a new worker node to take the place of each worker node you delete. When new worker nodes are started in the existing node pool, they run the more recent Kubernetes version you specified. See Performing an In-Place Worker Node Kubernetes Upgrade by Manually Replacing Nodes an Existing Node Pool.
- Perform an 'out-of-place' upgrade, by replacing the original node pool with a new node pool. First, you create a new node pool with a more recent Kubernetes version. Then, you drain existing worker nodes in the original node pool to prevent new pods starting, and to delete existing pods. Finally, you delete the original node pool. When new worker nodes are started in the new node pool, they run the more recent Kubernetes version you specified. See Performing an Out-of-Place Worker Node Kubernetes Upgrade by Replacing an Existing Node Pool with a New Node Pool.
Note that in both cases:
- The more recent Kubernetes version you specify for the worker nodes in the node pool must be compatible with the Kubernetes version running on the control plane nodes in the cluster. See Upgrading Clusters to Newer Kubernetes Versions).
- You must drain existing worker nodes in the original node pool. If you don't drain the worker nodes, workloads running on the cluster are subject to disruption.