Skip to main content

More Info:

Advisory: Kubernetes API audit logging should be enabled and forwarded to an external, tamper-resistant store so control-plane activity is retained independently of the cluster.

Risk Level

Medium

Address

Security

Compliance Standards

  • Cloudanix Best Practice

Triage and Remediation

Remediation

Manual Steps

  1. Identify the OKE cluster and compartment
    • On any machine with OCI CLI configured:
    • Note the id of the target cluster (for example, ocid1.cluster.oc1...).
  2. Check whether Kubernetes API audit logging is enabled for the cluster
    • Using OCI CLI on any machine:
    • In the JSON output, review any kubernetesAudit / apiServer / logging-related fields.
    • If the console exposes an “Audit logs” or “API server logs” toggle for OKE in the cluster’s details page, verify whether Kubernetes API audit logging is enabled there.
  3. Verify cluster logs are being shipped to OCI Logging
    • Using the OCI Console:
      • Go to Observability & Management → Logging → Log Groups.
      • In the compartment that contains the cluster, look for an OKE-related log group (for example, named with the cluster or node pool).
      • Open it and verify there is a log for control-plane or audit events (for example, “Kubernetes API Server Logs” or similar).
    • Or via OCI CLI on any machine:
    • Confirm that at least one log corresponds to API server / audit events.
  4. Confirm logs are exported off-cluster to a tamper-resistant destination
    • In the OCI Console, for each relevant OKE control-plane / audit log:
      • Go to Logging → Logs → <the log> → Actions / Configure Log.
      • Check for an active Service Connector or Log Rule exporting to:
        • OCI Logging Analytics, or
        • OCI Object Storage bucket with restricted access, or
        • OCI Logging to external SIEM / third-party sink.
    • With OCI CLI on any machine, list service connectors:
    • Inspect each connector’s source to confirm it pulls from the OKE log(s), and target to confirm it writes to an external, controlled, and access-logged destination.
  5. If audit logging or export is missing, configure it in OCI
    • In the OCI Console, navigate to the OKE cluster’s details page and:
      • Enable Kubernetes API / audit logging if an option exists for the cluster.
    • Then, under Observability & Management → Logging:
      • Create or identify a log group collecting the OKE control-plane / audit logs.
    • Under Service Connectors:
      • Create a new service connector with:
        • Source: the OKE audit/control-plane log(s).
        • Target: an OCI Object Storage bucket or Logging Analytics / external sink with write-only from logging services and tightly controlled read access.
    • If managing via IaC (Terraform), ensure corresponding oci_logging_log, oci_sch_service_connector, and, where supported, OKE cluster options for audit logging are defined and applied.
  6. Re-verify logging and export after configuration
    • Generate a few Kubernetes API events (for example, kubectl get pods -A) from any machine with kubectl access to the cluster.
    • In OCI Logging:
      • Open the OKE control-plane / audit log and confirm new entries appear matching the recent API calls.
    • In the configured external destination (Object Storage bucket, Logging Analytics, or external SIEM):
      • Confirm that newly generated audit log entries are present and that access controls on the destination prevent unauthorised modification or deletion.
kubectl cannot enable or configure Kubernetes API audit logging for Oracle OKE clusters, because this setting is managed entirely in the Oracle Cloud Infrastructure (OCI) / OKE control-plane configuration and associated logging services. To address this finding, use the OCI Console, CLI, or IaC (Terraform/Resource Manager) as described in the Manual Steps section.
How to interpret output (what indicates a problem)Run on any machine with oci and jq:
Problem indicators to investigate and manually remediate:
  • Verdict: NO_CONTROL_PLANE_LOGS
    → The script found no OKE-related control-plane/API logs. API audit logging is likely not enabled.
  • Verdict: CONTROL_PLANE_LOGS_NO_DESTINATION
    → Control-plane/API logs exist only inside OCI Logging, and no active Service Connector was found that exports them. This usually means logs are not shipped to an independent, tamper-resistant store.
CONTROL_PLANE_LOGS_WITH_DESTINATION is better, but still requires manual review of the destination (e.g., Object Storage bucket policies, retention, access controls) to decide whether it satisfies “external, tamper-resistant” for your environment.