'Upgrading' the Image Running on Worker Nodes by Creating a New Node Pool
When a node pool is created, the image to use for worker nodes in the node pool is specified. An image is a template of a virtual hard drive that determines the operating system and other software running on the worker nodes.
To 'upgrade' the image running on worker nodes in a node pool (for example, to upgrade to a new version of Oracle Linux), you replace the original node pool with a new node pool that has new worker nodes running the appropriate image. 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 image 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 Kubernetes 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 image running on worker nodes.
On the Cluster page, display the Node Pools tab, and then click Add Node Pool to create a new node pool and specify the required image for its worker 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
draincommand, 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 then select Delete Node Pool from the Actions menu beside the original node pool.
The original node pool and all its worker nodes are deleted.