Skip to main content

More Info:

When kubelet authorization is set to AlwaysAllow, every authenticated request is authorized regardless of identity. Use Webhook authorization so kubelet defers to the API servers RBAC for explicit decisions.

Risk Level

High

Address

Compliance, Security

Compliance Standards

  • CIS OKE

Triage and Remediation

Remediation

Using Console

Here’s how to remediate “Kubelet Authorization Mode = AlwaysAllow” on an OCI OKE cluster via the OCI Console.Because OKE is managed, you usually fix this at the node pool level. In many cases you cannot change kubelet flags in-place, so the safe pattern is:
  1. Create a new node pool with secure kubelet settings.
  2. Drain workloads from the old pool and delete it.
Below are the steps.

1. Identify the affected node pool(s)

  1. Sign in to the OCI Console.
  2. In the left menu, go to Developer Services → Kubernetes Clusters (OKE).
  3. Select the compartment and then click your cluster.
  4. Go to the Node Pools tab.
  5. For each node pool, note which ones were created with old/legacy settings (typically older pools are more likely using AlwaysAllow).
If you have OKE Terraform or scripts, you can also check there for kubelet extra args using --authorization-mode=AlwaysAllow.

2. Create a new node pool with secure kubelet authorization

  1. In the cluster details page, go to the Node Pools tab.
  2. Click Create node pool.
  3. Fill in the basics:
    • Name
    • Kubernetes version (match the existing cluster)
    • Compartment
    • VCN / Subnets (match existing topology)
  4. Under Node configuration / Kubelet configuration or Security section (names may vary slightly by OKE version/console UI):
    • Look for Kubelet security or Kubelet authorization mode.
    • Ensure it is NOT set to “AlwaysAllow”.
    • Select a secure option, typically:
      • Webhook (preferred in most modern setups), or
      • RBAC / Webhook+RBAC depending on the OKE UI.
  5. Keep any other settings (shape, boot volume, labels, taints, etc.) consistent with the old node pool, unless you intend to change them.
  6. Click Create and wait for the node pool status to become Active and all nodes become Ready in Kubernetes.

3. Move workloads from old node pool to new node pool

From here, use kubectl or the OCI Cloud Shell (Console → Developer Tools → Cloud Shell):
  1. Cordon nodes in the old node pool so new pods don’t get scheduled there:
    • If you don’t have a label, you can list all nodes and identify them by node name or provider ID.
  2. Drain the nodes to move workloads:
    • Ensure your workloads have ReplicaSets/Deployments or other controllers so pods are recreated on the new pool.
  3. Confirm pods are running on new nodes:

4. Delete the old node pool

Back in the OCI Console:
  1. Go to Developer Services → Kubernetes Clusters → select your cluster.
  2. Open the Node Pools tab.
  3. Select the old node pool (the one assumed to have AlwaysAllow).
  4. Ensure that:
    • All pods have been drained or migrated.
    • Node pool is safe to remove.
  5. Click Delete and confirm.

5. (Optional) Enforce via IaC / templates

If you manage OKE via Terraform/Resource Manager:
  • In the oci_containerengine_node_pool (or equivalent) resource:
    • Remove any kubelet --authorization-mode=AlwaysAllow from node_config_detailskubelet_config or node_metadata/cloud-init.
    • Explicitly set the correct kubelet mode if supported (e.g., Webhook).
  • Re-apply to ensure future node pools never use AlwaysAllow.

If you can share your current OKE version and whether you manage node pools via the console only or also Terraform, I can give you the exact field names you’ll see in your UI.
For Oracle Container Engine for Kubernetes (OKE), you cannot change the kubelet --authorization-mode from the OCI control plane or OCI CLI. That flag is set on the worker node OS itself.What you can do depends on the type of worker node pool you use:

1. Managed OKE node pools (standard OKE worker nodes)

On Oracle-managed node pools using Oracle platform images:
  • Kubelet is already configured with authorization-mode=Webhook by default on supported images.
  • You cannot override kubelet flags via OCI CLI; they are controlled by the node image and OKE.
If a scanner is flagging AlwaysAllow on these nodes, it is usually:
  • A false positive from the scanner (e.g., assuming defaults, not actually inspecting kubelet flags), or
  • An old, unsupported node image.
Remediation path (OCI CLI) is to replace or upgrade the node pool to a recent image:
  1. List node pools:
  2. Check the current image and node shape:
  3. Create a new node pool with a current platform image (which has kubelet Webhook mode):
    Where node-config.json contains subnet, availability domains, and uses a current platform image.
  4. Cordon & drain old nodes, then delete the old node pool:
This is the only practical way (via OCI) to “remediate” kubelet flags for managed node pools.

2. Custom / self-managed nodes attached to OKE

If you created your own worker nodes (e.g., via kubeadm on OCI Compute instances and then joined them to an OKE cluster), you must fix kubelet on the node OS. OCI CLI cannot change that; you use SSH + OS tools.On each node:
  1. SSH in (OCI CLI to get IPs if needed):
  2. Check kubelet arguments:
    If you see --authorization-mode=AlwaysAllow, it must be removed/changed.
  3. If kubelet uses a config file (/var/lib/kubelet/config.yaml), ensure it has:
  4. Remove or fix the --authorization-mode flag in the systemd drop-in, commonly:
    Ensure the KUBELET_KUBECONFIG_ARGS / KUBELET_CONFIG_ARGS line does not set --authorization-mode=AlwaysAllow. If you must specify, set:
  5. Reload and restart:
  6. Re-verify:

Key point

  • OCI CLI can manage node pools and instances, not kubelet flags.
  • For OKE-managed nodes: fix by upgrading/recreating node pools with up-to-date images.
  • For custom/self-managed nodes: fix kubelet on the host (SSH + systemd/config), then let OKE continue to use the node normally.
Below is a practical way to remediate “Kubelet Authorization Mode Should Not Be AlwaysAllow” for OCI OKE using Python, assuming:
  • You manage the worker node OS (custom node pool or self-managed nodes).
  • Kubelet is started via systemd with a config file containing --authorization-mode=AlwaysAllow.
If you are using fully managed OKE workers where Oracle controls kubelet flags, you cannot override --authorization-mode directly; you must instead:
  • Move to a supported OKE version/node image that no longer uses AlwaysAllow, or
  • Use custom worker nodes where you control kubelet startup.

1. What needs to change

On each worker node:
  1. Find the kubelet systemd unit config (commonly one of):
    • /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
    • /etc/systemd/system/kubelet.service
  2. Locate the line that has --authorization-mode=AlwaysAllow.
  3. Replace it with a more secure mode, e.g.:
(or --authorization-mode=Webhook,Node in some environments, if supported)
  1. Restart kubelet:

2. High‑level Python approach

  1. Use the OCI Python SDK to:
    • List clusters
    • List node pools
    • Get node instances (instance OCIDs)
  2. SSH into each node (e.g., using paramiko) and:
    • Edit the kubelet unit/config file
    • Reload systemd
    • Restart kubelet
Below is example code to illustrate the flow.

3. Example Python script (OCI SDK + Paramiko)

Install dependencies:
Python code:

4. Operational notes

  • Run this during a maintenance window; restarting kubelet can briefly disrupt pods on that node.
  • Test on a single node first.
  • If kubelet is configured via a different mechanism (cloud‑init, custom scripts, or kubeadm config files), adapt the file path and replacement logic accordingly.
  • For managed node pools where Oracle controls the kubelet flags and you cannot SSH or edit systemd units, remediation is not possible via Python; you must change to a configuration/image/version that does not use AlwaysAllow.