Reserve Resources for Kubelet and Operating System Daemons on Oracle Cloud Infrastructure Kubernetes Engine Nodes
Introduction
When running Kubernetes workloads on Oracle Cloud Infrastructure Kubernetes Engine (OKE), it is essential to ensure that worker nodes have reserved resources for Kubernetes control components and operating system (OS) daemons. Proper reservation prevents resource contention, reduces memory pressure, and enhances cluster stability. This is especially important in multi-tenant environments, high-density workloads, or when troubleshooting node pressure issues. In this tutorial, you will learn how to configure these reservations using a custom cloud-init
script applied at node pool creation. By leveraging cloud-init
, you can standardize these configurations across your cluster nodes with minimal effort.
Kubelet Resource Configuration
Kubelet, the primary node agent in Kubernetes, supports resource management through configuration flags or files. You can define:
- kubeReserved: Reserves resources for Kubernetes daemons like
kubelet
andkube-proxy
. - systemReserved: Reserves resources for OS-level services like
journald
orsshd
.
Objectives
-
Understand how to reserve CPU and memory for Kubernetes and OS daemons using
kubeReserved
andsystemReserved
. -
Deploy a managed node pool with a custom
cloud-init
script to apply the Kubelet configuration on startup.
Prerequisites
-
Access to an Oracle Cloud Infrastructure (OCI) account with permission to create OKE clusters and node pools.
-
An existing OKE cluster (or you can create a new one).
-
Basic familiarity with Kubernetes and Oracle Cloud Infrastructure Command Line Interface (OCI CLI).
Step 1: Write the cloud-init
Script
The following cloud-init
script creates a Kubelet configuration file that reserves CPU, memory, and ephemeral storage, and sets eviction thresholds.
#!/bin/bash
curl --fail -H "Authorization: Bearer Oracle" -L0 http://169.254.169.254/opc/v2/instance/metadata/oke_init_script | base64 --decode >/var/run/oke-init.sh
bash /var/run/oke-init.sh --kubelet-extra-args "--kube-reserved=cpu=500m,memory=1Gi --system-reserved=cpu=100m,memory=100Mi"
Step 2: Create a Node Pool With the cloud-init
Script
-
Go to the OCI Console and navigate to your OKE cluster.
-
Select Node pools, then click Add node pool to create a new one, or click Edit to modify an existing Node Pool.
-
Set your node pool with your preferences for Name, Compartment, Node placement, Shape, and Networking.
-
Under Show advanced options, click Paste Cloud-init Script and paste your custom script.
-
Complete the rest of the node pool settings and click Add.
Once the nodes are provisioned, the script runs at boot and applies your resource constraints automatically.
Note: If you are automating the setup with Terraform, you can pass the script in the
node_config_details.cloud_init_script
block when creating the node pool resource.
Acknowledgments
- Author - JP Santana (Master 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.
Reserve Resources for Kubelet and Operating System Daemons on Oracle Cloud Infrastructure Kubernetes Engine Nodes
G38456-01
Copyright ©2025, Oracle and/or its affiliates.