Skip to main content

More Info:

Set up the kubeconfig file appropriately and restrict cluster access so users have only the minimum permissions needed, preferring read-only access where possible.

Risk Level

Medium

Address

Security

Compliance Standards

  • CIS OKE

Triage and Remediation

Remediation

Manual Steps

  1. Identify how access is granted to the cluster
    • On any machine with access to your tenancy, list all OKE clusters and note which IAM groups/users use them (via tags, naming, or documentation).
    • In OCI Console: Developer Services → Kubernetes Clusters (OKE) → each cluster → Access Cluster, and note which IAM policies reference those compartments.
    • In Terraform (if used), inspect all oci_containerengine_cluster, oci_identity_policy, and oci_containerengine_cluster_kube_config resources to see who is granted access.
  2. Review OCI IAM policies that permit OKE access
    • In OCI Console: Identity & Security → Policies → search for statements with verbs related to OKE and Kubernetes access, for example use cluster-family, manage cluster-family, use kubeconfig.
    • For each policy, record:
      • The group(s)/dynamic group(s) it applies to.
      • Whether it allows broad access (e.g. manage all-resources on the compartment/tenancy) versus specific OKE-related verbs.
    • Decide which groups should be read-only versus admin/maintainer for OKE.
  3. Inspect generated kubeconfig files and bound identities
    • On any machine with kubectl access, list configured contexts and clusters:
    • For each user/context, determine whether the underlying OCI principal is a user or instance principal (from how the kubeconfig was created and from OCI CLI configuration in ~/.oci/config).
    • Map each user/context back to an OCI IAM group or dynamic group discovered in step 2.
  4. Evaluate Kubernetes RBAC for those identities
    • On any machine with kubectl access, gather RBAC assignments:
    • In these files, look for subjects that match the identities used in kubeconfig (service accounts, users, groups).
    • For each subject, verify whether the bound Role/ClusterRole is:
      • Read-only (e.g. only get, list, watch) or
      • Broad/admin (e.g. * verbs, built‑in cluster-admin, edit, admin).
    • Flag any identities that don’t need full privileges but are bound to admin or overly broad roles.
  5. Adjust access to minimize privileges (prefer read-only)
    • In OCI IAM (console or IaC), for groups that should only have read-only cluster access, replace broad policy statements with least-privilege ones (for example, inspect/read level verbs on OKE resources instead of manage all-resources).
    • In your IaC (Terraform or similar), update:
      • Any oci_identity_policy resources to narrow actions and scopes.
      • Any automation that generates kubeconfigs so that:
        • Only appropriate groups/users can generate admin kubeconfigs.
        • Others get kubeconfigs aligned with read-only RBAC where possible.
    • In Kubernetes RBAC (via manifests in IaC), ensure:
      • Operational/admin identities are bound to admin roles as required.
      • Other identities are bound to custom or built-in read-only roles (view or custom roles with only get, list, watch).
      • Remove or downgrade unnecessary cluster-admin/edit bindings.
  6. Re-verify effective access
    • From a sample read-only user’s environment, confirm access is limited:
    • Ensure:
      • Read operations (get, list, watch) required for that user are allowed.
      • Mutating operations (create, update, patch, delete) and wildcard verbs/resources are denied for users that should be read-only.
    • Repeat for admin/maintainer roles to verify they still have the necessary permissions.
kubectl cannot be used to change how kubeconfig files are created or how Oracle Cloud Infrastructure access to the cluster is restricted; those settings are controlled in the OCI console / IAM / API key configuration and any associated IaC. To address this finding, follow the guidance in the Manual Steps section for hardening kubeconfig generation and IAM policies.
How to interpret problems:
  • In sections 2 and 3, any Role/ClusterRole listed has verbs beyond get, list, watch.
  • In section 4, any human user or group (from your IdP) that appears is a candidate violation of “read‑only where possible”.
  • Use this report together with your cloud/IaC configuration and kubeconfig distribution records to decide where access should be reduced or split into read‑only vs admin profiles.