Upgrade Cluster and Node Pool Using Script

You can use the upgrade_cluster.py script to upgrade the Kubernetes version of the cluster and the node pools in your Oracle WebLogic Server for OKE stack.

The script upgrades the cluster and the node pool to the specified target version.

After you upgrade the cluster to 1.24, it is recommended to upgrade the kubectl version to 1.23.

Prerequisites:

Complete the following steps before you run the upgrade script:
  1. Access the administration instance. See Access the Administration Instance.
  2. Install OCI Python SDK on the administration instance.

    Note:

    To install OCI Python SDK, a NAT gateway must be configured for the administration instance private subnet.
    sudo bash
    python3 -m pip install oci==2.90

    If the pip command fails, then use the yum command to install OCI Python SDK.

    yum install python36-oci-sdk
  3. In the OCI Console, delete the nodes for each node pool in the cluster.
    1. Access the Oracle Cloud Infrastructure Console.
    2. From the navigation menu, select Developer Services. Under Containers & Artifacts, click Kubernetes Cluster (OKE).
    3. From the Compartment dropdown, select the compartment where your cluster is located.
    4. From the list of clusters, click the name of the cluster you want to modify.
    5. Under Resources, click Node Pools.
    6. From the list of node pools, click the name of the node pool.
    7. Under Resources, click Nodes.
    8. Make a note of the node count for the node pool.

      You have to create the same number of nodes that you have noted, after upgrading the cluster and node pool.

    9. Click the arrow on the right, and under Actions, click Delete Node. In the Confirm page, click Delete.

    See Delete a worker node in the Oracle Cloud Infrastructure documentation.

Upgrade the cluster and node pool using the script

You can use the script to upgrade the cluster, the node pool, or both cluster and node pool.

  1. Access the administration instance. See Access the Administration Instance.
  2. Go to /u01/scripts/utils location and create a file, upgrade_cluster.py.
  3. Copy and paste the script specified in Script file for Upgrade Cluster and Node Pool to the upgrade_cluster.py file.
  4. Run the following commands:

    Note:

    The current Kubernetes version supported for Oracle WebLogic Server for OKE is 1.28.x. To know the Kubernetes versions, see Currently Supported Kubernetes Versions in the Oracle Cloud Infrastructure documentation.

    When you are running the script to upgrade the cluster and node pool, you will see a downtime for the domain pods and Jenkins.

    • To upgrade the cluster and node pool:
      python3 /u01/scripts/utils/upgrade_cluster.py <target_k8s_version>
    • To upgrade only the cluster:
      python3 /u01/scripts/utils/upgrade_cluster.py <target_k8s_version> cluster
    • To upgrade only the node pool:
      python3 /u01/scripts/utils/upgrade_cluster.py <target_k8s_version> nodepool
  5. In the OCI Console, add the nodes for each node pool in the cluster. See step 3h to know the number of nodes to be added.
    1. Access the Oracle Cloud Infrastructure Console.
    2. From the navigation menu, select Developer Services. Under Containers & Artifacts, click Kubernetes Cluster (OKE).
    3. From the Compartment dropdown, select the compartment where your cluster is located.
    4. From the list of clusters, click the name of the cluster you want to modify.
    5. Under Resources, click Node Pools, and then click the node pool that you want to scale out.
    6. On the Node Pool details page, click Scale and edit the number of the nodes in the node pool.
    7. Click Scale to save the changes.
  6. Wait for the Node State of the nodes in the node pool to change to Active.
  7. Verify if the domain pods are up and running for each namespace.
    kubectl get po -n <domain_name>-ns
    If you are reusing the namespaces, use the following command to verify if the domain pods are up and running:
    kubectl get po -n <namespace>
  8. Verify if Jenkins is up and running by accessing the Jenkins console. See Access the Jenkins Console.