Skip to main content

More Info:

When anonymous authentication is enabled, requests not rejected by other authenticators are treated as anonymous and may reach kubelet APIs. Disabling anonymous auth is a hard requirement to prevent unauthenticated control-plane access on nodes.

Risk Level

Critical

Address

Compliance, Security

Compliance Standards

  • CIS OKE

Triage and Remediation

Remediation

Using Console

To disable anonymous requests to the kubelet in OCI OKE using the OCI Console, you need to update your node pool configuration so kubelet runs with anonymous authentication turned off. In most cases this is done by updating (or recreating) the node pool with the correct kubelet config.Below are the steps in the OCI Console.

1. Confirm your OKE cluster and node pool

  1. Sign in to the OCI Console.
  2. Open the navigation menu → Developer ServicesKubernetes Clusters (OKE).
  3. Select the Compartment where your cluster resides.
  4. Click your cluster name.
  5. In the cluster details page, go to the Node Pools tab.
  6. Identify the node pool(s) whose kubelet configuration you want to fix.

2. Check if node pool kubelet configuration is editable

For many OKE versions, key kubelet security options are controlled via the Kubelet configuration section on the node pool.
  1. In the Node Pools tab, click the node pool name.
  2. Click Edit or Update (top-right of the node pool details page).
  3. Expand Advanced OptionsKubelet configuration (or similar wording).
If the console exposes a checkbox or field related to anonymous authentication, use it (e.g. something like Disable anonymous access / Anonymous auth).
If not, you’ll need to specify a kubelet config block (JSON/YAML) through the console field provided.

3. Set kubelet to disallow anonymous auth

Within the Kubelet configuration section, you must ensure that kubelet is started with --anonymous-auth=false. Depending on what your OKE version exposes:
  • If there is a toggle/checkbox for anonymous auth:
    • Turn off / disable anonymous authentication (or enable “Disable anonymous access”).
  • If there is a raw kubelet config field:
    • Add or ensure a flag or parameter equivalent to:
      • anonymousAuth: false
        or
      • an extra-argument that sets --anonymous-auth=false.
Save/update the node pool when done.
Note: Exact field names can differ slightly by OKE/Kubernetes version. Look for anything documented or labeled around “anonymous authentication”, “anonymous access”, or kubelet security options.

4. Apply changes to worker nodes

Changing the node pool configuration alone does not always immediately reconfigure existing worker nodes. You typically need to recreate the worker nodes so they are started with the updated kubelet settings.You have two main options:

Option A – Rolling replacement within the same node pool (if supported):

  1. After saving the updated node pool configuration, scale the node pool up by adding new nodes.
  2. Wait for the new nodes to become Active and join the cluster.
  3. Cordon and drain old nodes (from kubectl):
  4. In the OCI Console, terminate the old nodes from the node pool.
  5. Repeat for each old node until all nodes in the node pool are newly created with the updated kubelet config.

Option B – Create a new node pool (cleaner approach):

  1. In the cluster page, go to Node PoolsCreate node pool.
  2. Configure it identically (shape, images, labels, taints, etc.) but:
    • Under Advanced Options → Kubelet configuration, set anonymous auth to disabled as described above.
  3. Create the node pool and wait for nodes to become Active.
  4. Use kubectl to cordon and drain nodes from the old node pool, then:
    • In the console, delete the old node pool once workloads are safely running on the new pool.

5. Verify that anonymous auth is disabled

After nodes with the new configuration are running:
  1. Get the node IPs:
  2. From a pod (or a secure bastion) with network access to node IPs, verify kubelet no longer accepts anonymous requests (for example, an unauthenticated curl to kubelet’s read-only port or API should now fail).
If available in your security tooling or benchmark scanner, re-run the CIS / security check that reported “Anonymous Requests to Kubelet Server Should Be Disabled” to confirm it passes.
If you share the exact OKE and Kubernetes version you’re running, I can give the precise field name/syntax for the kubelet configuration in your console view.
To disable anonymous requests to the kubelet on OKE worker nodes, you need to change the kubelet configuration on each node so that:
  • --anonymous-auth=false is set (or)
  • authentication: anonymous: enabled: false is set in the kubelet config file
OKE does not expose kubelet flags directly via the OCI CLI, so you use the OCI CLI to discover and SSH to nodes, then change the kubelet config on each node.Below are step‑by‑step commands and actions.

1. Get the node pool and node OCIDs

Note the id (nodePoolId) you want to remediate.
This returns the compute instance OCIDs for the worker nodes.

2. Get each node’s public IP (via OCI CLI)

For each worker instance OCID:
Use that IP for SSH.

3. SSH to each node

(Use ubuntu or other user if your image differs.)

4. Update kubelet config on the node

On each node:
  1. Locate the kubelet config file (for OKE it is usually /var/lib/kubelet/config.yaml):
  2. Ensure anonymous auth is disabled. The authentication section should look like:
    If anonymous.enabled is true or missing, edit the file:
    Add/modify:
    If the node is using flags instead of config.yaml, edit the kubelet systemd unit or environment file (often /etc/systemd/system/kubelet.service.d/10-kubelet-args.conf or similar) and ensure:
  3. Reload systemd and restart kubelet:
  4. Verify kubelet is healthy:
Repeat steps 3–4 for each worker node in the node pool.

5. (Optional) Bake this into node boot/launch

Because OKE re‑creates worker nodes (e.g., during scaling or upgrades), you should ensure new nodes get the same setting automatically. You can do this by:
  • Using a custom image where /var/lib/kubelet/config.yaml already has anonymous.enabled: false, or
  • Using cloud-init/bootstrapping scripts in the instance’s metadata.
Using OCI CLI to update instance metadata for the node pool’s instance configuration (template):
  1. Identify the instance configuration used by the node pool:
    Look for nodeConfigDetailsplacementConfigs / instance details, then trace back to the instance configuration (if used) via Compute → Instance Configurations.
  2. Update that instance configuration’s metadata to include a cloud-init script that enforces the kubelet config on boot.
Example (pseudo):
Where kubelet-hardening.yaml is a cloud-init script that edits /var/lib/kubelet/config.yaml to set authentication.anonymous.enabled: false and restarts kubelet.

6. Validate from the cluster

From a machine with kubectl access:
Optionally, from within the node, query the kubelet config endpoint and ensure anonymous access fails (or needs auth).
If you share your specific OKE node OS image and version (Oracle Linux vs Ubuntu, managed vs custom), I can give you the exact file paths and edit commands for that image.
To disable anonymous requests to the kubelet for Oracle OKE using Python, you need to:
  1. Configure the kubelet on each node pool to run with --anonymous-auth=false (and preferably disable the read-only port).
  2. Do this via an OKE Node Pool update using the OCI Python SDK (which will roll the nodes).
Below is a minimal, end‑to‑end example.

1. Prerequisites

  • Python 3.x
  • OCI Python SDK:
  • An OCI config file (~/.oci/config) with a profile that has:
    • Permission to MANAGE clusters and node pools in the target compartment.
  • Your OKE cluster OCID and/or node pool OCIDs.

2. High-level actions

For each node pool in your OKE cluster:
  1. Get the node pool definition.
  2. Update its kubelet configuration to:
    • anonymous-auth = false
    • (Optionally) read-only-port = 0 for extra hardening.
  3. Call UpdateNodePool via the OCI Container Engine client.
  4. Wait for the node pool to complete its rolling update.

3. Example Python script

This example:
  • Lists node pools for a given cluster.
  • Updates each node pool’s kubelet config to disable anonymous auth.
Adjust values in the CONFIG section.

4. Notes

  • Updating node pools this way typically triggers a rolling replacement of nodes; plan for impact.
  • Ensure your OKE version/API supports kubeletConfig on node pools; if it doesn’t, you must instead use a custom cloud-init or image that sets --anonymous-auth=false on kubelet before OKE manages the node.
  • After completion, validate on a node:
If you share your current OKE version and a sample get_node_pool output, I can tailor the exact fields to your environment.
Changing kubelet_config.is_anonymous_auth_enabled does not force replacement of the node pool resource itself, but OKE will roll nodes to apply the new kubelet configuration (expect node recreation / disruption during the rollout).To verify, terraform plan should show an in-place update on oci_containerengine_node_pool.OKE_NODEPOOL with kubelet_config.is_anonymous_auth_enabled changing from true (or null) to false.