Learning center

Find the subject of a forbidden Kubernetes API request in audit logs

Use the audit event for the failed API call when the workload's error leaves out its identity. Compare the recorded user and any impersonated user before choosing which subject to investigate.

In a fictional cluster, a controller receives a 403 while watching deployments in reports. The matching audit event has responseStatus.code: 403, verb: watch, and objectRef.resource: deployments. The user.username field names system:serviceaccount:jobs:report-watcher. If impersonatedUser is present, keep both identities in the receipt and ask whether the request failed before or after impersonation was accepted. Kubernetes auditing ยท Audit Event API fields

Use a read-only query of the configured audit sink by time, audit ID when available, and request attributes. A metadata-level audit policy can record user, resource and verb without recording request bodies. If the audit policy omitted this request, the current pod or credential configuration can suggest a caller but cannot establish which identity made the historical call.

Trace another denied request.

One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. Eligibility and fair-use terms.

Start free with GitHub

Related reading