Note:
- This tutorial requires access to Oracle Cloud. To sign up for a free account, see Get started with Oracle Cloud Infrastructure Free Tier.
- 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.
Update OCI Kubernetes Engine Node Pool Capacity Types to Preemptible for E5 Shapes using OCI CLI
Introduction
This technical tutorial is a follow up of Manage OCI Kubernetes Engine with Different Capacity Types and Resolve Common Issues on Preemptible Nodes. In this tutorial, we are going to demonstrate how to update on-demand or capacity-reservation capacity types to preemptible using the update Oracle Cloud Infrastructure Command Line Interface (OCI CLI) command.
This is for a use case running fault tolerant workloads on OCI, and want to update the existing E5-shape capacity-reservation or on-demand capacity type to preemptible for cost savings. This can be accomplished using the update command as there is a known issue with the console.
Objectives
- Work with Oracle Cloud Infrastructure Kubernetes Engine (OKE) for different capacity types and update node pool capacity types using OCI CLI.
Prerequisites
-
Administrator access to an OCI tenancy and OKE cluster running.
Task 1: Update E5 Shape On-Demand OKE Worker Node Pool to Preemptible using OCI CLI
-
Log in to the OCI Console and click the services menu.
-
Navigate to Developer Services.
-
Under Containers & Artifacts, click Click Kubernetes Engine (OKE).
-
Click OCI Cloud shell to display the CLI.
-
Access the cluster by setting up the KubeConfig Configuration File.
-
Edit
node-pool
OCID,subnet-id
,fault domain
, configuration and size before running the following CLI commands in your tenancy.oci ce node-pool update --node-pool-id ocid1.nodepool.oc1.iad.aaaaaaaarxeqfrkuxxxxxxxxxxxxxxxxxxxxx634lggdpxwalnnz63c45dcq --node-shape VM.Standard.E5.Flex --placement-configs '[{"availabilityDomain": "FZyT:US-ASHBURN-AD-2", "faultDomains":["FAULT-DOMAIN-1"],"preemptibleNodeConfig": {"preemptionAction": {"isPreserveBootVolume": true, "type": "TERMINATE"}},"subnetId": "ocid1.subnet.oc1.iad.aaaaaaaabfcbfxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxh45aqipmr4qn2ta"}]' --node-shape-config '{"memoryInGBs": 6.0,"ocpus": 1.0}' --pod-subnet-ids '["ocid1.subnet.oc1.iad.aaaaaaaabxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx45aqipmr4qn2ta"]'
This will output OCID of the work request for updating the node pool and update E5 on-demand worker node to preemptible in the existing cluster as shown in the following images.
This will automatically cycle the nodes as shown in the following image.
Task 2: Update E5 Shape Capacity-Reservation OKE Worker Node Pool to Preemptible using CLI
-
Log in to the OCI Console and click the services menu.
-
Navigate to Developer Services.
-
Under Containers & Artifacts, click Click Kubernetes Engine (OKE).
-
Click OCI Cloud shell to display the CLI.
-
Access the cluster by setting up the KubeConfig Configuration File
-
Edit
node-pool
OCID,compartment
OCID,subnet-id
,fault domain
, configuration and size before running the following CLI commands in your tenancy.oci ce node-pool update --node-pool-id ocid1.nodepool.oc1.iad.aaaaaaaa2qpvpexxxxxxxxxxxxxxxxxxxxxxxxxxrcg6btcgurnlkbsqfzp5a --node-shape VM.Standard.E5.Flex --placement-configs '[{"availabilityDomain": "FZyT:US-ASHBURN-AD-2", "faultDomains":["FAULT-DOMAIN-1"],"preemptibleNodeConfig": {"preemptionAction": {"isPreserveBootVolume": true, "type": "TERMINATE"}},"subnetId": "ocid1.subnet.oc1.iad.aaaaaaaabfcbfmhxxxxxxxxxxxxxxxxxxxxxh45aqipmr4qn2ta"}]' --node-shape-config '{"memoryInGBs": 6.0,"ocpus": 1.0}' --pod-subnet-ids '["ocid1.subnet.oc1.iad.aaaaaaaabfcbfxxxxxxxxxxxxxxxxxxxxxxxxxxx45aqipmr4qn2ta"]'
This will output OCID of the work request for updating the node pool and update E5 capacity-reservation worker node to preemptible in the existing cluster as shown in the following images.
This will automatically cycle the nodes as shown in the following image.
Related Links
Acknowledgments
- Author - Payal Sharma (Senior Enterprise Cloud Architect)
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.
Update OCI Kubernetes Engine Node Pool Capacity Types to Preemptible for E5 Shapes using OCI CLI
G26170-01
February 2025
Copyright ©2025, Oracle and/or its affiliates.