Note:
- This tutorial is available in an Oracle-provided free lab environment.
- It uses example values for Oracle Cloud Infrastructure credentials, tenancy, and compartments. When completing your lab, substitute these values with ones specific to your cloud environment.
Upgrade the Kubernetes Version on Oracle Cloud Native Environment
Introduction
Best practices recommend upgrading your Kubernetes cluster as soon after a new release as possible. The reasons to upgrade as quickly as possible include:
- Apply the latest security fixes
- Access stability and performance improvements
- Access new features, APIs & functionality
This tutorial demonstrates how to upgrade the Kubernetes version used on your Oracle CNE cluster.
For more information about Oracle CNE, please refer to the current Release Documentation site.
Objectives
In this tutorial, you’ll learn to:
- Upgrade the Kubernetes version deployed across your cluster
Prerequisites
-
Minimum of one Oracle Linux instance
-
Each system should have Oracle Linux installed and configured with:
- An Oracle user account (used during the installation) with sudo access
- Key-based SSH, also known as password-less SSH, between the hosts
- A working KVM libvirt environment.
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.
-
Open a terminal on the Luna Desktop.
-
Clone the
linux-virt-labs
GitHub project.git clone https://github.com/oracle-devrel/linux-virt-labs.git
-
Change into the working directory.
cd linux-virt-labs/ocne2
-
Install the required collections.
ansible-galaxy collection install -r requirements.yml
-
Deploy the lab environment.
ansible-playbook create_instance.yml -e localhost_python_interpreter="/usr/bin/python3.6" -e install_ocne_rpm=true
The free lab environment requires the extra variable
local_python_interpreter
, which setsansible_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.The default deployment shape uses the AMD CPU and Oracle Linux 8. To use an Intel CPU or Oracle Linux 9, add
-e instance_shape="VM.Standard3.Flex"
or-e os_version="9"
to the deployment command.Important: Wait for the playbook to run successfully and reach the pause task. At this stage of the playbook, the installation of Oracle CNE 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.
Start a Kubernetes Cluster
We’ll use a single control plane and worker node cluster based on Kubernetes v1.30 with plans to upgrade to 1.31.
-
Open a terminal and connect via SSH to the ocne instance.
ssh oracle@<ip_address_of_node>
-
Start the cluster.
ocne cluster start --version 1.30 -n 1 -w 1 -u false
-
Set the kubeconfig environment variable for your new cluster.
export KUBECONFIG=$(ocne cluster show -C ocne)
Where ocne is the default name for a cluster unless specified. You can then use
kubectl get nodes
to show the two nodes and verify that they are running version 1.30.
Update Kubernetes
Kubernetes requires you to update one version at a time, so if you need to upgrade more than one version, you’ll need to repeat these steps for each version.
-
Stage the next Kubernetes version.
ocne cluster stage -v 1.31
-
Get a list of your cluster nodes.
kubectl get nodes
-
Check if there are updates available.
watch ocne cluster info
Monitor until you see nodes with available updates: 2 reported in the output. Enter
Ctrl-c
to exit the watch command. -
Update the control plane node.
You must first update all control plane nodes within the cluster.
ocne node update -N ocne-control-plane-1
The update may take a few minutes to complete after the command finishes. You can use
kubectl get nodes
to check the version of the control plane node. -
Update the worker node.
ocne node update -N ocne-worker-1 --delete-emptydir-data
Repeat the command if you get a warning that an upgrade is unavailable or the cluster cannot perform it. This small cluster may take a few minutes to stabilize before you can update the worker node.
The worker node requires the
--delete-emptydir-data
option because theui
Pod uses anemptyDir
volume to share content across its running containers. -
Verify the version of the cluster nodes.
kubectl get nodes
Repeat the command until the output shows that each node is at the expected version.
Next Steps
Knowing how to keep the latest Kubernetes version deployed onto your Oracle CNE cluster ensures your cluster remains updated with all the latest security and stability fixes.
Related Links
- Oracle Cloud Native Environment Documentation
- Oracle Cloud Native Environment Track
- Oracle Linux Training Station
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.
Upgrade the Kubernetes Version on Oracle Cloud Native Environment
G32043-01
Copyright ©2025, Oracle and/or its affiliates.