All possible Kubernetes events with type

Viewed 1489

I want to react to certain Kubernetes/Openshift events, therefor I need a list of all possible (Kubernetes) events with their type (normal vs. warning).

Openshift event list (but without type info)

Event data example:

   {
      "metadata": {
         ...
      },
      "involvedObject": {
         ...
      },
      "reason": "Created",
      "firstTimestamp": "...",
      "lastTimestamp": "...",
      "count": 1,
      "type": "Normal",
      "eventTime": null,
    }

Is there any relation between the type and the reason of the event?

How can I create/find such a comprehensive list (event reasons + type + involved object kind)?

1 Answers

Posting this answer as a community wiki to give more of a baseline to the question than the actual solution. Feel free to expand it.

I haven't found the Kubernetes equivalent of the OpenShift documentation like used in the question:


From Kubernetes perspective you can look on the source code of the components to see what events they can send.

Kubelet example:


const (
    FailedToKillPod                = "FailedKillPod"
    FailedToCreatePodContainer     = "FailedCreatePodContainer"
    FailedToMakePodDataDirectories = "Failed"
    NetworkNotReady                = "NetworkNotReady"
)

const (
    CreatedContainer        = "Created"
    StartedContainer        = "Started"
    FailedToCreateContainer = "Failed"
    FailedToStartContainer  = "Failed"
    KillingContainer        = "Killing"
    PreemptContainer        = "Preempting"
    BackOffStartContainer   = "BackOff"
    ExceededGracePeriod     = "ExceededGracePeriod"
)

The relation between the type and a reason for an event could be described as:

// Valid values for event types (new types could be added in future)
const (
    // Information only and will not cause any problems
    EventTypeNormal string = "Normal"
    // These events are to warn that something might go wrong
    EventTypeWarning string = "Warning"
)

As you can see below the Normal type event was for the information that is not causing any issues. The Warning type event was created where there was an issue (trying to download not existent image: fake):

11s         Warning   Failed              pod/fake-f68cd66bc-hgxxv      Error: ErrImagePull
11s         Normal    BackOff             pod/fake-f68cd66bc-hgxxv      Back-off pulling image "fake"
11s         Warning   Failed              pod/fake-f68cd66bc-hgxxv      Error: ImagePullBackOff
14s         Normal    SuccessfulCreate    replicaset/fake-f68cd66bc     Created pod: fake-f68cd66bc-hgxxv
14s         Normal    ScalingReplicaSet   deployment/fake               Scaled up replica set fake-f68cd66bc to 1
50s         Normal    Scheduled           pod/nginx-6799fc88d8-ks76h    Successfully assigned default/nginx-6799fc88d8-ks76h to docker-desktop

To have a list of the events that happened in the cluster you could try to use dedicated application inside Kubernetes cluster to watch on the events and store them in a storage option of your choosing.


Additional resources:

Related