Logit.io
Use Kubernetes audit logs to find who deleted a pod
← Back to blog
11/24/2026 · 15 min read

Use Kubernetes audit logs to find who deleted a pod

Logit.io Team
Logit.io Team
Technical Content Team

Last updated 11/24/2026

How To GuidesSecurity

To find who requested a pod deletion, open the Kubernetes API-server audit log for the affected cluster and look for verb: delete on the named pod in its namespace. Group the stages by auditID, then read user.username, any impersonatedUser, and responseStatus.code on ResponseComplete. A 403 records a refusal. A 202 records acceptance, and the pod may still be terminating. If the requester is a controller, use the pod’s owning workload and its change history to see how far you can trace the decision.

The policy, sample events and CloudWatch envelope below are illustrative. This guide uses Kubernetes 1.34 and audit.k8s.io/v1. You'll read a minimal audit policy for a self-managed API server, turn three sample events into two request outcomes with jq, and work through a controller handoff. The EKS example starts with an already enabled audit log group and shows how to unpack a CloudWatch message before looking for the same fields.

Contents

Choose the record that can answer who

What each source records

Start with the cluster, the namespace, the pod name and the last time the pod was seen. Add its UID if you have it in a retained inventory or a prior observation. A replacement can reuse a pod name, so a name match narrows the search while the UID ties an observation to a particular pod. Use a UTC time window that starts before the first symptom. A delete request can arrive while the pod is still serving, and the last application log line can land well into shutdown.

Container output can show how the application shut down. A Kubernetes Event object can show a kubelet killing a container or a controller scaling a workload. The API-server audit record answers a different question. It records the identity on the API request, the resource targeted and, at the completed stage, the response. Logit.io’s documented Kubernetes dashboard packs use container logs and cluster Event objects. If those audit records are in a Logit Logs stack, search the *-* index pattern in OpenSearch Dashboards Dev Tools. If you use a term filter, check whether the field is mapped as text or .keyword. Search separately collected API-server audit logs for fields such as auditID and user.username. Container logs and Kubernetes Event dashboards

Ask which audit policy or provider setting applied at the time of the incident, which stages it recorded, and where those records were retained. Check any export at the source before troubleshooting the forwarded copy. A blank destination can result from a missing source record, an expired window, a delivery gap or a parsing problem. Knowing which copy you checked gives the platform team somewhere specific to pick up the investigation.

Self-managed audit policy

This complete example uses the Kubernetes 1.34 API-server audit policy format. The empty group matches the core API, pods matches the main resource, and delete matches a named pod deletion request. With this policy on its own, unmatched operations go unlogged. In an existing policy, the first matching rule wins, so check where a broader rule would match the same request. The example leaves the stages available to record receipt and completion. Kubernetes auditing and policy rules

apiVersion: audit.k8s.io/v1
kind: Policy
rules:
  - level: Metadata
    verbs: ["delete"]
    resources:
      - group: ""
        resources: ["pods"]

On a self-managed control plane, the platform owner makes the policy readable to each API-server instance using --audit-policy-file and chooses an audit backend. For the file backend, --audit-log-path points to a writable log file in the API server’s filesystem. For an API server running as a pod, account for mounts for both paths and make sure the log survives a container restart. Confirm that the retained source covers all API-server replicas that could have handled the request. Keep this example’s configuration separate from EKS control-plane logging.

Metadata records request and response metadata without collecting request or response bodies. The policy and examples also omit authorization headers and sensitive object data. Real metadata still carries details such as user names, resource names and request URIs. Treat audit files as security logs and review what the forwarding path retains before sharing excerpts. The sample events below are illustrative. Save the three JSON lines as pod-delete-audit.jsonl if you want to run the jq commands, and compare those rows with the policy. Every row is a metadata event for a core pod delete request. The checks only read files.

Reconstruct one deletion request

Audit event fields

The three sample events below refer to shop/checkout-1. Each line is one Event from audit.k8s.io/v1. objectRef identifies the resource, namespace and name. requestReceivedTimestamp anchors the API request, and stageTimestamp tells you when that particular stage was recorded. Read the audit schema when deciding which fields your export can supply. Some fields are optional, including the impersonated identity and the response status. Kubernetes audit Event and Policy reference

{"apiVersion":"audit.k8s.io/v1","kind":"Event","level":"Metadata","auditID":"a0000000-0000-4000-8000-000000000001","stage":"RequestReceived","requestURI":"/api/v1/namespaces/shop/pods/checkout-1","verb":"delete","user":{"username":"system:serviceaccount:kube-system:replicaset-controller"},"objectRef":{"resource":"pods","namespace":"shop","name":"checkout-1","apiVersion":"v1"},"requestReceivedTimestamp":"2026-11-24T10:14:02.110000Z","stageTimestamp":"2026-11-24T10:14:02.110000Z"}
{"apiVersion":"audit.k8s.io/v1","kind":"Event","level":"Metadata","auditID":"a0000000-0000-4000-8000-000000000001","stage":"ResponseComplete","requestURI":"/api/v1/namespaces/shop/pods/checkout-1","verb":"delete","user":{"username":"system:serviceaccount:kube-system:replicaset-controller"},"objectRef":{"resource":"pods","namespace":"shop","name":"checkout-1","apiVersion":"v1"},"responseStatus":{"code":202},"requestReceivedTimestamp":"2026-11-24T10:14:02.110000Z","stageTimestamp":"2026-11-24T10:14:02.126000Z"}
{"apiVersion":"audit.k8s.io/v1","kind":"Event","level":"Metadata","auditID":"a0000000-0000-4000-8000-000000000002","stage":"ResponseComplete","requestURI":"/api/v1/namespaces/shop/pods/checkout-1","verb":"delete","user":{"username":"[email protected]"},"impersonatedUser":{"username":"system:serviceaccount:shop:read-only"},"objectRef":{"resource":"pods","namespace":"shop","name":"checkout-1","apiVersion":"v1"},"responseStatus":{"reason":"Forbidden","code":403},"requestReceivedTimestamp":"2026-11-24T10:14:01.980000Z","stageTimestamp":"2026-11-24T10:14:01.987000Z"}

One request can produce several audit events with the same auditID. RequestReceived shows that the API server received the request. ResponseComplete is the stage to prefer for the returned outcome. A duplicate copy of a stage can also arrive during forwarding. Keep the stage sequence for diagnosis and count requests by audit ID within the source cluster. When a group has a receipt but no completed record, report that you observed the attempt and that the outcome is unknown from the available rows.

Grouped stages and outcomes

Save the three events listed above as pod-delete-audit.jsonl. Save the filter below as pod-delete-timeline.jq, then run the commands that follow with jq 1.7.1. The first command checks the version. The second reads the JSON lines into an array, groups them by audit ID, and keeps groups that contain a named delete on the core pod resource in the requested namespace. Grouping first keeps related stages together even if a stage in an export has fewer identifying fields. Treat group_by(.auditID) as a heuristic: clients can supply Audit-ID values, so collisions are possible. Pair the identifier with the timestamp, user and objectRef before treating a group as one request.

map(select(.kind == "Event" and .apiVersion == "audit.k8s.io/v1"
           and (.auditID | type == "string" and length > 0)))
| group_by(.auditID)
| map(
    select(any(.[]; .verb == "delete"
      and .objectRef.resource == "pods"
      and (.objectRef.apiGroup // "") == ""
      and (.objectRef.subresource // "") == ""
      and .objectRef.namespace == $namespace
      and .objectRef.name == $pod))
    | sort_by(.stageTimestamp) as $stages
    | ([$stages[] | select(.stage == "ResponseComplete")] | last) as $completed
    | ($completed // $stages[-1]) as $event
    | {
        auditID: $event.auditID,
        verb: $event.verb,
        objectRef: $event.objectRef,
        namespace: $event.objectRef.namespace,
        username: $event.user.username,
        impersonatedUsername: $event.impersonatedUser.username,
        stage: $event.stage,
        responseStatus: $event.responseStatus,
        stages: [$stages[] | {stage, stageTimestamp}],
        requestReceivedTimestamp: $event.requestReceivedTimestamp
      }
  )
| sort_by(.requestReceivedTimestamp)
jq --version
jq -s --arg namespace shop --arg pod checkout-1 \
  -f pod-delete-timeline.jq pod-delete-audit.jsonl

The projection chooses the last ResponseComplete by stage time when one exists, and otherwise uses the latest available stage. Check the selected stage and responseStatus together before calling the outcome. The stages array preserves the rows behind the choice. Use a small export for one cluster and incident window, since jq -s reads the whole input into memory. If the collection mixes clusters, separate them by source before grouping.

UTC stage timeAudit ID suffixStageRequester and statusWhat this row establishes
10:14:01.9870002ResponseComplete[email protected], acting as system:serviceaccount:shop:read-only, received 403The API server refused this request. This example contains only its completed stage.
10:14:02.1100001RequestReceivedsystem:serviceaccount:kube-system:replicaset-controller, status absentThe API server received the controller request against the same named pod.
10:14:02.1260001ResponseCompleteSame controller identity, 202The API server accepted that request. Confirm final removal separately.

The command should return two request summaries from three input rows. Verify that the summary ending in 0001 has two stages and status 202, and that the summary ending in 0002 has status 403 and both identity fields. Both should show namespace shop, pod checkout-1 and logical verb delete. The earlier refusal and the later acceptance have separate audit IDs, even though they target the same name within a fraction of a second.

For a successful individual delete, look for a completed 2xx response on a named core pod, and check the original audit row’s requestURI for dry-run options before drawing conclusions about persistence. At Metadata level, check requestURI for dryRun. Metadata events never record the request body, so a dryRun set only in DeleteOptions is visible only when a Request or RequestResponse rule logged the event. Here the 202 establishes acceptance of the controller’s request. Pod grace periods and finalizers can delay removal. To establish when the old pod actually disappeared, look for a recorded DELETED notification for its UID from a watch whose selectors could not have excluded the pod during an update, or use a retained inventory that brackets the disappearance and distinguishes the old UID from any replacement. A later observation narrows the removal window to the evidence you have.

Collection deletes and evictions

If the named delete search is empty, check whether the source retained related operations. A collection delete uses deletecollection and targets a collection, potentially narrowed by selectors in the request URI. Its outcome applies to that request. To establish what happened to a particular pod, reconstruct collection membership at that time and corroborate the pod’s fate with lifecycle evidence. A current label listing may describe a different set of pods.

An eviction requested through the API commonly appears as verb: create on pods/eviction. Inspect objectRef.subresource, the namespace and pod name, and the completed response. A kubelet eviction can also explain a disappearance, in which case node and pod lifecycle records are the place to look for the trigger. The sample policy captures named pod deletes only. To investigate collection deletes or API evictions from audit, you need a policy or provider feed that recorded those operations at the time.

Follow a controller identity one step further

Requester vs workload change

Record the authenticated caller from user.username. When impersonatedUser.username is present, also record the effective identity named in that field. In the 403 example, the original caller is [email protected] and the request was evaluated as the read-only service account. Keep the two in separate worksheet columns or in the same cell with explicit labels. A user name that looks like an email is still an authenticated identity. Use identity or session records when the incident requires establishing who used it.

A name of the form system:serviceaccount:<namespace>:<name> identifies a service account. In the example the caller is a controller account in kube-system, while the target pod is in shop. First identify which workload owned the old pod. A retained pod snapshot can provide the controller owner reference, including the owner UID. For a Deployment, follow the pod’s ReplicaSet reference and the ReplicaSet’s Deployment reference. Use historical snapshots or inventory if the pod or the owner has already disappeared.

Suppose the retained inventory ties checkout-1 to the checkout Deployment through its ReplicaSet. Look for a change to that Deployment, its scale subresource or its owning automation immediately before the delete. For example, a deployment run that reduced the desired replica count from three to two gives you a change to test against the ReplicaSet’s scale-down history. To connect it to a person, match the workload and effective revision or replica change to a completed API write, a release record, or the Git change and the deployment run that applied it. For an automated scaling decision, check the autoscaler’s recorded action and distinguish that decision from an earlier human edit to scaling settings.

A matching workload and timestamp can establish where to look next. The example audit policy records pod deletes, so the relevant Deployment write may only be available in a broader audit stream or a separate change system. If a deployment identity is all you have and the deployment run cannot be tied to a person, record the controller identity as the API requester and leave the human change author unknown. Preserve the audit ID, workload identifiers and the time window so the next team can continue from the same evidence.

CaseEvidence to write downFindingEvidence needed for the next handoff
Accepted controller requestAudit ID ending 0001, controller service account, shop/checkout-1, 202 at ResponseCompleteThe controller made the named delete request and the API accepted it.Ask the platform team for the original pod UID and the watch or inventory record that brackets its removal.
Rejected requestAudit ID ending 0002, authenticated [email protected], effective system:serviceaccount:shop:read-only, 403The API refused the attempted delete under the effective identity.If the attempt needs follow-up, give the access owner the audit ID and UTC window for the available session and authorisation records.
Human change author unknownAudit ID ending 0001 and, in this hypothetical follow-up, a retained owner chain to checkout. The release record has only an automation identity.The caller and owning workload are known. The human change author remains unknown.Ask the workload owner for the exact revision or replica change and its link to an applied deployment run, API write or scaling decision.

Work through the EKS evidence path

Audit emission and forwarding

Amazon EKS is one route to the same kind of evidence. Start with the EKS control-plane audit log type and the incident time. When enabled, EKS delivers those audit records to the cluster’s CloudWatch Logs group, named /aws/eks/<cluster-name>/cluster. Ask the cluster owner to confirm that this log type was enabled when the request happened and that the incident window is still retained. Enabling it starts collection going forward. Historical requests that were never logged remain missing. EKS controls the managed API server’s audit output, so check the records it actually emitted for their stages and fields. Amazon EKS control-plane logging

EKS API server with control-plane audit logging enabled
  → CloudWatch Logs group for the cluster
  → CloudWatch subscription and Lambda forwarding
  → decode the delivery and parse each audit message for field search

The CloudWatch transport depends on the selected group already containing the audit records. Logit.io documents forwarding a CloudWatch Logs group with Lambda. For an investigation, identify that group and the subscription handling it, then confirm where the message is unpacked and which audit fields reach the searchable destination. Keep the cluster or log-group identity with the parsed record for later scoping. Forward a CloudWatch Logs group

CloudWatch message unwrapping

The example listing below is a decoded CloudWatch subscription payload. Save it as cloudwatch-audit-envelope.json. CloudWatch subscription delivery to Lambda wraps the compressed, base64-encoded payload in awslogs.data. This example starts after that outer layer has been decoded and decompressed. Its logEvents[].message is still a string. The example reuses the accepted request’s completed record to demonstrate transport shape, so a single message is enough to exercise the parser.

{
  "messageType": "DATA_MESSAGE",
  "owner": "000000000000",
  "logGroup": "/aws/eks/example-cluster/cluster",
  "logStream": "kube-apiserver-audit-example",
  "subscriptionFilters": [
    "example-subscription"
  ],
  "logEvents": [
    {
      "id": "1",
      "timestamp": 1795515242126,
      "message": "{\"apiVersion\":\"audit.k8s.io/v1\",\"kind\":\"Event\",\"level\":\"Metadata\",\"auditID\":\"a0000000-0000-4000-8000-000000000001\",\"stage\":\"ResponseComplete\",\"requestURI\":\"/api/v1/namespaces/shop/pods/checkout-1\",\"verb\":\"delete\",\"user\":{\"username\":\"system:serviceaccount:kube-system:replicaset-controller\"},\"objectRef\":{\"resource\":\"pods\",\"namespace\":\"shop\",\"name\":\"checkout-1\",\"apiVersion\":\"v1\"},\"responseStatus\":{\"code\":202},\"requestReceivedTimestamp\":\"2026-11-24T10:14:02.110000Z\",\"stageTimestamp\":\"2026-11-24T10:14:02.126000Z\"}"
    }
  ]
}

Save the following filter as cloudwatch-audit-messages.jq. It selects data delivery messages and parses each event’s message string into an object. The second command passes the parsed object to the same timeline filter used on the local JSON lines.

select(.messageType == "DATA_MESSAGE")
| .logEvents[]
| .message
| fromjson
jq -c -f cloudwatch-audit-messages.jq cloudwatch-audit-envelope.json

jq -c -f cloudwatch-audit-messages.jq cloudwatch-audit-envelope.json |
  jq -s --arg namespace shop --arg pod checkout-1 -f pod-delete-timeline.jq

Expect one summary ending in 0001 with one ResponseComplete stage, the controller username and status 202. If auditID is visible inside the raw message but a field search is empty, inspect whether the inner message became an object. If parsing fails, inspect the envelope type and the value at logEvents[].message. When the parsed event looks right but the result is empty, recheck the source cluster, incident window, namespace and resource filters.

FAQ

Can I find a deletion from before auditing was enabled?

Look for a copy retained by another source or for independent evidence such as a controller action or deployment run. If the API server never emitted the audit record, switching audit logging on today leaves that historical gap. Record which source and time window were checked and what the remaining evidence can establish.

Does a completed delete mean the pod is gone?

ResponseComplete describes the API response. Read its status code, then check the original pod’s lifecycle by UID. A successful response can come before graceful termination finishes, and a replacement with the same name can already be visible by the time you investigate.

Can I identify a human from a controller username?

The username identifies the caller on the pod delete. A retained owner chain can take you to the workload and then to the release, scaling decision or other change that explains the controller’s action. Name a human change author only when the change records tie that person to the action that was applied.

What does the Logit.io free trial include?

The 14-day Logit.io free trial includes every feature, including centralised security logging and Hosted OpenSearch MCP. No credit card is required. Hosted OpenSearch MCP works with any MCP client that supports remote HTTPS connections and custom authorisation headers. Logit.io trial documentation and Hosted OpenSearch MCP client requirements

Next steps

Save the full audit IDs, source cluster and UTC window with your incident. Record the accepted or rejected outcome, who made the request, and whether the pod’s removal and the initiating change have independent evidence. Once your audit records are emitted and forwarded with their fields intact, use Logit.io as a managed SIEM destination for centralised security logs. Review SIEM as a Service

Start Free Trial

Unlock complete visibility with hosted ELK, Grafana, and Prometheus-backed Observability

Start Free Trial

Get the latest Elastic Stack & logging resources when you subscribe

Want to see this in action?
Start a free trial and connect logs to your alert workflows.