To 'upgrade' the version of Kubernetes running on worker nodes in a node pool, you replace the original node pool with a new node pool that has new worker nodes running the appropriate Kubernetes version. Having 'drained' existing worker nodes in the original node pool to prevent new pods starting and to delete existing pods, you can then delete the original node pool.
To 'upgrade' the version of Kubernetes on worker nodes by creating a new node pool:
- In the Console, open the navigation menu. Under Solutions and Platform, go to Developer Services and click Container Clusters.
- Choose a Compartment you have permission to work in.
- On the Cluster List page, click the name of the cluster where you want to change the Kubernetes version running on worker nodes.
On the Cluster page, click Add Node Pool to create a new node pool and specify the required version of Kubernetes for its worker nodes.
The version of Kubernetes you specify must be compatible with the version that is running on the master nodes.
- If there are labels attached to worker nodes in the original node pool and those labels are used by selectors (for example, to determine the nodes on which to run pods), then use the
kubectl label nodescommand to attach the same labels to the new worker nodes in the new node pool. See Assigning Pods to Nodes in the Kubernetes documentation.
For each worker node in the original node pool, prevent new pods from starting and delete existing pods by entering
kubectl drain <node_name>for each worker node.
For more information:
- about using kubectl, see Accessing a Cluster Using Kubectl
- about the drain command, see drain in the Kubernetes documentation
Recommended: Leverage pod disruption budgets as appropriate for your application to ensure that there's a sufficient number of replica pods running throughout the drain operation.
After all the worker nodes have been drained from the original node pool and pods are running on worker nodes in the new node pool, you can delete the original node pool.
On the Cluster page, display the Node Pools tab and select Delete Node Pool from the Actions menu.
The original node pool and all its worker nodes are deleted.