# Events

Events tell you why a workload is pending, restarting, unhealthy, or
unreachable. To see who changed an object, read the
[audit log](/docs/configure/#audit-logs) instead.

## Read events

```bash
kubectl get events --all-namespaces
kubectl get events --namespace default --field-selector=reason=FailedScheduling
kubectl get events --namespace default --watch
```

:::note
The control plane deletes an Event an hour after it last changed. To catch one,
start a watch before you repeat the operation. A watch does not replay past
Events, so when it ends, list the Events again.
:::

## Filter events

A field selector uses the field names of the API that you call. The API serves
`v1` and `events.k8s.io/v1` over the same stored Events, so you can write
through one API and read through the other.

| Field                                                     | `v1`                                                    | `events.k8s.io/v1`                                   |
| --------------------------------------------------------- | ------------------------------------------------------- | ---------------------------------------------------- |
| Object (`kind`, `name`, `namespace`, `uid`, `apiVersion`) | `involvedObject.<field>`                                | `regarding.<field>`                                  |
| Reporter                                                  | `source`, `reportingComponent`                          | `reportingController`, `reportingInstance`, `action` |
| Other                                                     | `metadata.name`, `metadata.namespace`, `reason`, `type` | Same as `v1`                                         |

## Event reasons

:::note

- The node agent writes its Events with the reporter `kubelet` and the node's
  name as the host, as kubelet does upstream, so a tool that selects a node's
  Events by their reporter finds them.
- A `SuccessfulCreate`, `FailedCreate`, `SuccessfulDelete` or `FailedDelete`
  Event refers to the workload whose controller wrote the object, such as the
  ReplicaSet of a Pod or the CronJob of a Job.
- `NodeReady`, `NodeNotReady` and `CSITopologyRefused` Events are in the
  `default` namespace, and each node has at most one of each.

:::

| Reason                       | Type    | Reporter                           | Written when                                                                                              |
| ---------------------------- | ------- | ---------------------------------- | --------------------------------------------------------------------------------------------------------- |
| `Scheduled`                  | Normal  | `default-scheduler`                | A Pod is assigned to a node                                                                               |
| `FailedScheduling`           | Warning | `default-scheduler`                | No node can accept a Pod                                                                                  |
| `Preempted`                  | Normal  | `default-scheduler`                | A Pod is removed for a higher-priority Pod                                                                |
| `Created`                    | Normal  | `kubelet`                          | A container is created                                                                                    |
| `Started`                    | Normal  | `kubelet`                          | A container runs or has exited after running                                                              |
| `Failed`                     | Warning | `kubelet`                          | A container cannot be created                                                                             |
| `Killing`                    | Normal  | `kubelet`                          | The node stops a container for a deleted Pod or a failed liveness probe, startup probe or postStart hook  |
| `BackOff`                    | Warning | `kubelet`                          | A container waits before its next restart, or restarts after a non-zero exit                              |
| `Unhealthy`                  | Warning | `kubelet`                          | A startup, readiness, or liveness probe fails                                                             |
| `ProbeWarning`               | Warning | `kubelet`                          | A probe's response is a redirect that it does not follow, such as one to another host                     |
| `FailedMount`                | Warning | `kubelet`                          | A Pod volume cannot be mounted                                                                            |
| `FailedKillPod`              | Warning | `kubelet`                          | The node cannot stop the containers or the sandbox of a Pod that is deleted or evicted                    |
| `FailedPostStartHook`        | Warning | `kubelet`                          | A container's postStart hook fails, so the node stops the container                                       |
| `FailedPreStopHook`          | Warning | `kubelet`                          | A container's preStop hook fails, and the node stops the container anyway                                 |
| `LifecycleHTTPFallback`      | Warning | `kubelet`                          | An HTTPS httpGet hook passes only when the node sends it again over HTTP                                  |
| `MissingJob`                 | Normal  | `cronjob-controller`               | An active Job for a CronJob disappears                                                                    |
| `SawCompletedJob`            | Normal  | `cronjob-controller`               | A Job that a CronJob started completes or fails                                                           |
| `JobAlreadyActive`           | Normal  | `cronjob-controller`               | A CronJob with `concurrencyPolicy: Forbid` skips a run because its last Job still runs                    |
| `Completed`                  | Normal  | `job-controller`                   | A Job completes                                                                                           |
| `BackoffLimitExceeded`       | Warning | `job-controller`                   | A Job fails because its Pods failed more times than `backoffLimit`                                        |
| `DeadlineExceeded`           | Warning | `job-controller`                   | A Job fails because it ran longer than `activeDeadlineSeconds`                                            |
| `PodFailurePolicy`           | Warning | `job-controller`                   | A Job fails because a failed Pod matches a `FailJob` rule                                                 |
| `FailedIndexes`              | Warning | `job-controller`                   | An Indexed Job with `backoffLimitPerIndex` fails because an index failed                                  |
| `MaxFailedIndexesExceeded`   | Warning | `job-controller`                   | An Indexed Job fails because more indexes failed than `maxFailedIndexes`                                  |
| `TooManySucceededPods`       | Warning | `job-controller`                   | A Job completes with more succeeded Pods than `completions`                                               |
| `Suspended`                  | Normal  | `job-controller`                   | A Job is suspended                                                                                        |
| `Resumed`                    | Normal  | `job-controller`                   | A suspended Job resumes                                                                                   |
| `SuccessfulCreate`           | Normal  | `<kind>-controller`                | A workload's controller creates a Pod, a CronJob creates a Job, or a StatefulSet creates a member's claim |
| `FailedCreate`               | Warning | `<kind>-controller`                | A workload's Pod is refused on create                                                                     |
| `SuccessfulDelete`           | Normal  | `<kind>-controller`                | A workload's controller deletes one of its Pods, or a CronJob deletes one of its Jobs                     |
| `FailedDelete`               | Warning | `<kind>-controller`                | Admission refuses a workload controller's delete of its Pod                                               |
| `ScalingReplicaSet`          | Normal  | `deployment-controller`            | A Deployment changes the replica count of one of its ReplicaSets                                          |
| `ReplicaSetCreateError`      | Warning | `deployment-controller`            | Admission or a ResourceQuota refuses the create of a Deployment's ReplicaSet                              |
| `SuccessfulRescale`          | Normal  | `horizontal-pod-autoscaler`        | A HorizontalPodAutoscaler changes its target's replica count                                              |
| `NodeReady`                  | Normal  | `node-controller`                  | A disconnected node's agent connects again, or its host cancels a shutdown                                |
| `NodeNotReady`               | Normal  | `node-controller`                  | A node's agent disconnects, or its host starts to shut down                                               |
| `TaintManagerEviction`       | Normal  | `taint-eviction-controller`        | A Pod is marked for deletion by a `NoExecute` taint, or the deletion is cancelled                         |
| `CSITopologyRefused`         | Warning | `kubelet`                          | A node's CSI driver reports topology labels the node may not set                                          |
| `BindingConditionsPending`   | Normal  | `default-scheduler`                | A Pod waits for its devices' binding conditions before it is bound                                        |
| `DeviceTaintManagerEviction` | Normal  | `device-taint-eviction-controller` | A Pod is marked for deletion by a `NoExecute` device taint, or the deletion is cancelled                  |

### Node pool reasons

The node pool controller writes these Events with the reporter
`nodepool-controller`, in the `default` namespace, except `NoNodePoolFits`,
which it writes in the Pod's namespace. When a call to the
cloud provider fails, the controller retries it on its next reconcile.

| Reason                      | Type    | On        | Written when                                                                                                                                                                                                                                                        |
| --------------------------- | ------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `FailedReconcile`           | Warning | NodeClaim | The controller cannot advance the NodeClaim                                                                                                                                                                                                                         |
| `FailedDelete`              | Warning | Node      | The provider cannot delete the Node's machine                                                                                                                                                                                                                       |
| `Disrupting`                | Normal  | Node      | The controller deletes the node's NodeClaim                                                                                                                                                                                                                         |
| `Replacing`                 | Normal  | Node      | The node no longer matches its class (it drifted), and the controller waits for a new machine for its pods before it drains the node. See [Class changes](/docs/node-pools/#class-changes).                                                                         |
| `Draining`                  | Normal  | Node      | The controller cordons the node and evicts its pods                                                                                                                                                                                                                 |
| `DrainGraceExpired`         | Warning | Node      | `terminationGracePeriod` runs out while pods are still on the node                                                                                                                                                                                                  |
| `DeletingMachine`           | Normal  | Node      | The controller calls the provider to delete the machine                                                                                                                                                                                                             |
| `RemovingNode`              | Normal  | Node      | The provider no longer lists the machine, and the Node is deleted                                                                                                                                                                                                   |
| `NoNodePoolFits`            | Warning | Pod       | No pool can ever make a machine that fits the Pod, and no Node fits it either. The message gives each pool's reason.                                                                                                                                                |
| `RegistrationTimeout`       | Warning | NodePool  | A NodeClaim's machine does not join before the pool's `registrationTimeout`, and the controller deletes the claim and the machine. The message holds the last lines that the machine's startup script printed to its console, or why the console could not be read. |
| `MachinesUnlisted`          | Warning | NodePool  | The controller cannot list the pool's machines, for example because a class's credential no longer works. Until the list succeeds, the controller deletes none of those machines, and no NodeClaim or Node whose machine is gone.                                   |
| `DisruptionBlocked`         | Normal  | NodePool  | A disruption budget keeps consolidation or drift from removing another node. See [Disruption budgets](/docs/node-pools/#disruption-budgets).                                                                                                                        |
| `DisruptionBlocked`         | Normal  | Node      | The Node, or a pod on it, has `kiteplane.dev/do-not-disrupt` or `karpenter.sh/do-not-disrupt`, so neither consolidation nor drift removes the node. See [Keep a node](/docs/node-pools/#keep-a-node).                                                               |
| `UnreachableDeletionPaused` | Warning | NodePool  | Too many of the cluster's nodes are unreachable, so the pool stops deleting unreachable nodes. See [Capacity refusals](/docs/reference/node-pools/#capacity-refusals).                                                                                              |

### Tunnel reasons

The tunnel controller writes these Warnings with the reporter
`cloudflare.com/tunnel`. `CredentialsUnusable`, `TunnelUnavailable` and
`TeardownAbandoned` refer to the IngressClass and are in the `default`
namespace. The rest refer to the Ingress or the Service.

| Reason                | Written when                                                                                                 |
| --------------------- | ------------------------------------------------------------------------------------------------------------ |
| `Unsupported`         | A tunnel configuration has an unsupported backend or protocol                                                |
| `UnsupportedProtocol` | A Service has no HTTP port, and a port sets `appProtocol: kubernetes.io/h2c`                                 |
| `NoHostname`          | A `LoadBalancer` Service has no `cloudflare.com/hostname` annotation                                         |
| `NoClusterIP`         | A backing Service has no ClusterIP                                                                           |
| `ServiceNotFound`     | An Ingress rule refers to a Service that does not exist                                                      |
| `PortNotFound`        | A Service does not have the port that an Ingress rule refers to                                              |
| `AmbiguousPort`       | A `LoadBalancer` Service has more than one HTTP port                                                         |
| `HostnameInUse`       | A DNS record that the controller did not create already uses the hostname                                    |
| `CredentialsUnusable` | The class's parameters, Secret, `accountId`, `zoneId`, or `apiToken` is missing                              |
| `TunnelUnavailable`   | The controller cannot apply the tunnel, or a retry cannot remove a tunnel or DNS records that the class left |
| `TeardownAbandoned`   | Cloudflare rejects the API token that made a tunnel or DNS records that the class left, so they may remain   |

## Event updates

:::caution
Do not alert on `count`. Most reasons keep it at 1.
:::

| Reason                                                                     | One Event per                                                                      | Updated when                                                                                                 | `count`                                                                                                      |
| -------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
| `Created`, `Started`, `Failed`, `BackOff`, `Unhealthy`, `ProbeWarning`     | Occurrence                                                                         | Never: each occurrence is a new Event                                                                        | 1                                                                                                            |
| `FailedKillPod`                                                            | Pod, while the node cannot stop it                                                 | The error changes                                                                                            | 1                                                                                                            |
| `Killing`                                                                  | Container, written as the node starts to stop it, before its preStop hook runs     | The node stops the container for another reason, such as a failed liveness probe and then the Pod's deletion | 1                                                                                                            |
| `FailedPostStartHook`, `FailedPreStopHook`                                 | Container, while the Event lasts, however often the hook fails                     | —                                                                                                            | 1                                                                                                            |
| `FailedScheduling`                                                         | Pod that keeps failing to schedule                                                 | At once when the reason changes, otherwise at most once a minute, with the latest message                    | Failed attempts since the first. After a restart of the control plane, it can be lower than the real number. |
| `FailedCreate` for a missing ServiceAccount, RuntimeClass or PriorityClass | Workload                                                                           | The message changes                                                                                          | 1                                                                                                            |
| `FailedCreate` for any other refusal                                       | Workload, at most one each time its controller tries to create the workload's Pods | As [Rate limits](#rate-limits) says                                                                          | Events combined                                                                                              |
| `FailedDelete`                                                             | Workload, for the first Pod that admission refuses each time the controller tries  | The message changes                                                                                          | 1                                                                                                            |
| `ReplicaSetCreateError`                                                    | Deployment                                                                         | The message changes                                                                                          | 1                                                                                                            |

- A `FailedCreate` Event carries the API server's refusal of a workload's Pod,
  in the words that Kubernetes uses. A missing ServiceAccount, RuntimeClass or
  PriorityClass is refused before the API server generates the Pod's name, so
  the Event names the Pod by its prefix, such as `web-`. Any other refusal,
  such as a ResourceQuota's, a LimitRange's, Pod Security's or a
  ValidatingAdmissionPolicy's, names the Pod itself.
- When admission or a ResourceQuota refuses the ReplicaSet for a Deployment's
  template, the Deployment's `Progressing` condition is `False` with the same
  reason and message as the `ReplicaSetCreateError` Event, unless the
  Deployment has no progress deadline. The controller tries the create again
  after a wait that doubles up to a minute.

## Rate limits

The workload controllers limit their Events about one object as upstream's do:

- From the tenth Event with the same reason within 10 minutes, a controller
  updates one Event whose message starts with
  `(combined from similar events):`, and adds one to its `count` for each
  Event that it combines.
- A controller writes at most 25 of these Events about an object at once, and
  one more every 5 minutes after that. The next Event that it writes counts
  the ones that it skipped.
- A restart of the control plane starts the limits again.

So a ReplicaSet scaled to 1,000 Pods has ten `SuccessfulCreate` Events: one
for each of the first nine Pods, and one combined Event.

## Next

- [Troubleshoot](/docs/troubleshoot/): the first check for each symptom.
- [Manage nodes](/docs/manage-nodes/): join, check, and remove a host.
