Note:

How To Upgrade Oracle Cloud Native Environment

Introduction

Administrators of an Oracle Cloud Native Environment deployment are aware that many of the components, such as Kubernetes, are regularly updated. The upgrade process updates these components to the most recent release, allowing users to access any new features.

This tutorial will show how to upgrade an Oracle Cloud Native Environment from the previous minor release.

Note: Please note that Oracle Cloud Native Environment upgrades are incremental and not cumulative. This upgrade method is due to a limitation in the Kubernetes and Istio modules, which require incremental upgrades.

Objectives

In this lab, you’ll learn how to:

Prerequisites

Deploy Oracle Cloud Native Environment

Note: If running in your own tenancy, read the linux-virt-labs GitHub project README.md and complete the prerequisites before deploying the lab environment.

  1. Open a terminal on the Luna Desktop.

  2. Clone the linux-virt-labs GitHub project.

    git clone https://github.com/oracle-devrel/linux-virt-labs.git
    
  3. Change into the working directory.

    cd linux-virt-labs/ocne
    
  4. Install the required collections.

    ansible-galaxy collection install -r requirements.yml
    
  5. Change the Oracle Cloud Native Environment repository versions.

    The deployment project’s defaults_vars.yml file sets variables that install the latest version of Oracle Cloud Native Environment on the running version of Oracle Linux.

    cat << EOF | tee repos.yml > /dev/null
    ol8_enable_repo: "ol8_olcne17"
    ol8_disable_repo: "ol8_olcne12 ol8_olcne13 ol8_olcne14 ol8_olcne15 ol8_olcne16"
    EOF
    
    
  6. Deploy the lab environment.

    ansible-playbook create_instance.yml -e localhost_python_interpreter="/usr/bin/python3.6" -e "@repos.yml"
    

    The free lab environment requires the extra variable local_python_interpreter, which sets ansible_python_interpreter for plays running on localhost. This variable is needed because the environment installs the RPM package for the Oracle Cloud Infrastructure SDK for Python, located under the python3.6 modules.

    Important: Wait for the playbook to run successfully and reach the pause task. At this stage of the playbook, the installation of Oracle Cloud Native Environment is complete, and the instances are ready. Take note of the previous play, which prints the public and private IP addresses of the nodes it deploys and any other deployment information needed while running the lab.

Changing the Software Packages Source

  1. Open a terminal and connect via SSH to the ocne-operator node.

    ssh oracle@<ip_address_of_node>
    
  2. Verify the current Oracle Cloud Native Environment repository.

    sudo dnf repolist
    

    Look for a repo id that contains olcne.

  3. Update the Oracle Cloud Native Environment repository on each node to the next minor release and disable the existing one.

    for host in ocne-operator ocne-control-01 ocne-worker-01 ocne-worker-02
    do
      printf "======= $host =======\n\n" 
      ssh $host "sudo dnf update oracle-olcne-release-el8; sudo dnf config-manager --enable ol8_olcne18; sudo dnf config-manager --disable ol8_olcne17 ol8_olcne16 ol8_olcne15 ol8_olcne14 ol8_olcne13 ol8_olcne12"
     done 
    
    
  4. Confirm the update of the repository version.

    sudo dnf repolist
    

Upgrade the Operator Node

  1. Stop the olcne-api-server service.

    sudo systemctl stop olcne-api-server.service
    
  2. Update the Oracle Cloud Native Environment packages.

    sudo dnf update -y olcnectl olcne-api-server olcne-utils
    
  3. Start the olcne-api-server service.

    sudo systemctl start olcne-api-server.service
    

Upgrade the Kubernetes Nodes

  1. Upgrade the Platform Agent on all nodes.

    olcnectl environment update olcne --environment-name myenvironment
    

    Note: This will take a few minutes to complete.

    Example:

    Taking backup of modules before update
    Backup of modules succeeded.
    Updating modules
    Update successful
    

Upgrading the Kubernetes Cluster

  1. Upgrade all Kubernetes nodes to the latest Kubernetes version available for Oracle Cloud Native Environment.

    olcnectl module update --environment-name myenvironment --name mycluster --kube-version 1.28.3
    

    Note: This may take 3-5 minutes to complete.

    The command will upgrade to the latest version of Kubernetes provided by Oracle. To get the version number of the latest Kubernetes release for Oracle Cloud Native Environment, see the Release Notes.

    This command’s completion stating Update successful indicates that each Kubernetes cluster node has been successfully upgraded to the latest Kubernetes release. It also confirms that each node is validated and is healthy.

Confirm the Upgrade of the Kubernetes Nodes

  1. Confirm that Kubernetes has been upgraded.

    ssh ocne-control-01 kubectl get nodes
    

    The version column should show the version used with the kube-version option in the update command.

  2. Confirm that all the Oracle Cloud Native Environment components are running as expected.

    ssh ocne-control-01 kubectl get pods --all-namespaces
    

    The STATUS column should show all the pods in a Running state.

  3. Get a complete report of the Oracle Cloud Native Environment’s settings using the olcne module report command.

    This report can return its output in YAML format or as a CLI-formatted table. The CLI-formatted table requires the Oracle Linux Terminal to use UTF-8 encoding. To set this configuration, click the Terminal menu item > Set Encoding > Unicode > UTF-8.

    olcnectl module report --environment-name myenvironment --name mycluster --children
    
  4. Rerun the command, sending the output in YAML format.

    olcnectl module report --environment-name myenvironment --name mycluster --children --format yaml
    

Summary

That concludes the walkthrough demonstrating how to upgrade an Oracle Cloud Native Environment install from one minor release to the next.

For More Information

More Learning Resources

Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.

For product documentation, visit Oracle Help Center.