More Info:
The kubelet-config.json file should be owned by root:root. Incorrect ownership lets unprivileged users alter kubelet runtime parameters such as authentication and authorization modes.Risk Level
HighAddress
Compliance, SecurityCompliance Standards
- CIS OKE
Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
You can’t change
1. Understand where
On OKE worker nodes (OCI‑supplied images), the kubelet config is typically under:(If you know your cluster image path differs, substitute the correct one in the script below.)
This will:
You should see:
If you tell me your exact OKE image version (Oracle Linux version / node shape) I can adjust the path or script for that specific environment.
kubelet-config.json ownership purely with a “button” in the OCI Console, because the file lives on each worker node’s OS. However, you can use the Console to push a startup script (cloud‑init / user data) to your node pool so that every node enforces root:root on boot and on replacement.Below are step‑by‑step instructions to do this using only the OCI Console, without manually SSH’ing to each node.1. Understand where kubelet-config.json lives
On OKE worker nodes (OCI‑supplied images), the kubelet config is typically under:/etc/oci/kubelet/kubelet-config.json
or/var/lib/kubelet/config.yaml(for some newer versions)
kubelet-config.json, so assume path:2. Create a bootstrap script to fix ownership
You’ll store this as user data for the node pool via the Console.Prepare this script locally (you’ll paste it in step 3):- Set owner to
root:root - Set permissions to
600 - Ensure on every reboot the ownership is re‑applied.
3. Add the script as cloud‑init user data to your node pool
- In the OCI Console, go to:
- Developer Services → Kubernetes Clusters (OKE).
- Click your cluster.
- Go to the Node Pools tab.
- Click the node pool you want to fix.
- Click Edit (or Update Node Pool).
- Find the Node configuration details / Cloud-init script / User data section:
- If a script already exists, append the content above to the end of that script (do not remove existing logic).
- If empty, paste the script from step 2 in full.
- Save / Update Node Pool.
4. Rotate / Recreate nodes so the script runs
The script only runs when nodes (re)boot with the new user data.From the same node pool page:- Use Scale or Node Pool → Reboot / Terminate Nodes to cycle nodes:
- Safest: cordon and drain nodes one by one from kubectl, then terminate them so the node pool recreates them with the new user data.
- As each node is recreated, the script runs and fixes ownership.
5. (Optional) Verify on a node
If you are allowed to SSH into worker nodes:If you tell me your exact OKE image version (Oracle Linux version / node shape) I can adjust the path or script for that specific environment.
Using CLI
Using CLI
You can’t change Unix file ownership directly with the OCI CLI alone (the CLI manages OCI resources, not in-guest files), but you can use it to run a command inside each OKE worker node to fix the ownership.Below are step‑by‑step instructions using Compute Instance Run Command via OCI CLI.
Note the
3. Run
Assume path to kubelet config is Explanation:
The base64 script is:You should see
If you tell me your exact kubelet config path on OKE, I can give you a ready‑to‑run CLI command with the right file path only.
1. Prerequisites
- Oracle Cloud Agent enabled on worker nodes (OKE default worker images usually have this).
- Policy allowing you to use instance run command, e.g.:
- OCI CLI configured (
oci setup config).
2. Find the worker nodes (instances) of your OKE cluster
- Get the node pools for your cluster:
- For each node pool, list nodes and map to instance OCIDs:
instance-id values – these are the Compute instances you’ll run commands on.3. Run chown root:root on each node instance
Assume path to kubelet config is /var/lib/kubelet/config.json or /etc/kubernetes/kubelet/kubelet-config.json. Use the path that applies in your environment.Example using /var/lib/kubelet/config.json:- The
contentis a base64‑encoded bash script:
--variablespasses the target file path as argument"$1".
INSTANCE_ID from step 2.4. Verify ownership
You can:- Either run another instance‑agent command to check:
- Or SSH into a node and run:
root root as the owner/group.5. Make it persistent for new nodes
For new/recreated worker nodes in OKE:- Add a cloud-init script in your custom node image or in the node pool config that runs on boot:
- Or bake the correct ownership directly into a custom image used by the node pool.
If you tell me your exact kubelet config path on OKE, I can give you a ready‑to‑run CLI command with the right file path only.
Using Python
Using Python
To remediate “OCI OKE kubelet-config.json File Ownership Should Be root:root” using Python, you essentially need to:
Assume you find it at:Use that path in the Python script.
Run on node:
Build and push to OCIR (or any registry):Adjust Apply:Logs from one pod:Once confirmed, you can delete the DaemonSet:
This satisfies the requirement “kubelet-config.json File Ownership Should Be root:root” in OCI OKE.
- Find the kubelet config path on OKE worker nodes.
- Change its owner to
root:root(uid=0,gid=0). - Do this on every worker node (manually via SSH or automatically via a DaemonSet).
1. Identify kubelet-config.json path on OKE
On OKE worker nodes, the kubelet config is typically at one of these paths (depending on OKE version / image):/etc/kubernetes/kubelet/kubelet-config.json/var/lib/kubelet/config.json/etc/oci-addons/kubelet/kubelet-config.json
2. Python script to set ownership to root:root
This script:- Verifies file exists.
- Sets owner to
rootand group toroot. - Optionally verifies after change.
3. Automate across all OKE nodes (DaemonSet approach)
If you want to avoid SSHing to each node, run the Python script in a privileged DaemonSet so it executes once on every node.3.1. Build a small Python image
Dockerfile (example):KUBELET_CONFIG in the script if your path is different.3.2. DaemonSet YAML
4. Verify remediation
On a worker node:Using Terraform
Using Terraform

