-->

DEVOPSZONES

  • Recent blogs

    How to upgrade OCI Container Engine for Kubernetes(OKE)

    How to upgrade OKE
    How to upgrade OKE


     

    After a new version of Kubernetes has been released and when Container Engine for Kubernetes supports the new version, you can upgrade the Kubernetes version running on control plane nodes and worker nodes in a cluster.

    You upgrade control plane nodes and worker nodes differently:

    • You upgrade control plane nodes by upgrading the cluster and specifying a more recent Kubernetes version for the cluster. Control plane nodes running older versions of Kubernetes are upgraded. Because Container Engine for Kubernetes distributes the Kubernetes Control Plane on multiple Oracle-managed control plane nodes to ensure high availability (distributed across different availability domains in a region where supported), you're able to upgrade the Kubernetes version running on control plane nodes with zero downtime.

    • You upgrade worker nodes in one of two ways:

      • By performing an 'in-place' upgrade of a node pool in the cluster, specifying a more recent Kubernetes version for the existing node pool.
      • By performing an 'out-of-place' upgrade of a node pool in the cluster, replacing the original node pool with a new node pool for which you've specified a more recent Kubernetes version.
    We will be performing "in-place" upgrade for worker nodes in this blog post. 

    Upgrading the Kubernetes Version on Control Plane Nodes in a Cluster

    When Container Engine for Kubernetes supports a newer version of Kubernetes than the version currently running on the control plane nodes in a cluster, you can upgrade the Kubernetes version running on the control plane nodes.

    Using the Console

    To upgrade the version of Kubernetes running on the control plane nodes:

    • In the Consoleopen the navigation menu and click Developer Services. Under Containers, click Kubernetes Clusters (OKE).
    OKE
    OKE


    • Choose a Compartment you have permission to work in.
    • On the Cluster List page, click the name of the cluster where you want to upgrade the Kubernetes version running on the control plane nodes.

    If a newer Kubernetes version is available than the one running on the control plane nodes in the cluster, the Upgrade Available button is enabled at the top of the Cluster page.


    OKE upgrade available
    OKE upgrade available


    • Click Upgrade Available to upgrade the control plane nodes to a newer version.
    • In the Upgrade Cluster Master dialog box, select the Kubernetes version to which to upgrade the control plane nodes, and click Upgrade.
    upgrade kubernetes


    The Kubernetes version running on the control plane nodes is upgraded. From now on, the new Kubernetes version will appear as an option when you’re defining new node pools for the cluster.

    Status Screens: 

    OKE upgrading


    OKE Upgraded


    In-Place Worker Node Upgrade by Updating an Existing Node Pool

    You can upgrade the version of Kubernetes running on worker nodes in a node pool by specifying a more recent Kubernetes version for the existing node pool. For each worker node, you first drain it to prevent new pods starting and to delete existing pods. You then terminate the worker node so that a new worker node is started, running the more recent Kubernetes version you specified. When new worker nodes are started in the existing node pool, they run the more recent Kubernetes version you specified.

    To perform an in-place upgrade of a node pool in a cluster, by specifying a more recent Kubernetes version for the existing node pool:

    • In the Consoleopen the navigation menu and click Developer Services. Under Containers, click Kubernetes Clusters (OKE).
    Choose OKE
    Choose OKE


    • 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, display the Node Pools tab, and click the name of the node pool where you want to upgrade the Kubernetes version running on the worker nodes.

    OKE Node pool
    OKE Node pool


    • On the Node Pool page, click Edit and in the Version field, specify the required Kubernetes version for worker nodes.

    • The Kubernetes version you specify must be compatible with the version that is running on the control plane nodes.
    • Click Save Changes to save the change.

    OKE Edit Node pool
    OKE Edit Node pool


    • You now have to terminate existing worker nodes so that new worker nodes are started, running the Kubernetes version you specified.
    • For the first worker node in the node pool:

      • Prevent new pods from starting and delete existing pods by entering:     kubectl drain <node_name> --ignore-daemonsets

    Kubectl_drain_node
    Kubectl_drain_node


      • On the Node Pool page, display the Nodes tab and click the worker node's name in the Node Name field.
      • On the Instances page, select Terminate from the More Actions menu.
    OKE_Terminate_Node
    OKE_Terminate_Node


    • The worker node is terminated and a new worker node is started in its place, running the Kubernetes version you specified.
    OKE_Terminated_Node
    OKE_Terminated_Node

    OKE_Worker_Node_with_new_version
    OKE_Worker_Node_with_new_version


    • Repeat the previous step for each remaining worker node in the node pool, until all worker nodes in the node pool are running the Kubernetes version you specified.

    No comments