All Products
Search
Document Center

Simple Log Service:Create and use K8s event center

Last Updated:Aug 28, 2026

Kubernetes events record state changes in your cluster, such as pod creation, running, and deletion, or component errors. K8s event center collects all Kubernetes cluster events in real time and provides storage, querying, analysis, visualization, and alerting capabilities. This topic describes the procedure for creating and using a K8s event center.

Background information

The Kubernetes architecture is based on a state machine. When the system transitions between states, it generates events. Transitions between normal states produce Normal events, while transitions between normal and abnormal states produce Warning events.

ACK (Container Service for Kubernetes) provides an out-of-the-box event monitoring solution for containerized environments. It uses the ACK-maintained node-problem-detector (NPD) and its included component, kube-eventer, to provide event monitoring.

  • node-problem-detector (NPD) is a tool for diagnosing Kubernetes nodes. It converts node anomalies, such as Docker Engine hangs, Linux kernel hangs, public network access exceptions, and file descriptor issues, into node events. When combined with kube-eventer, it enables a closed-loop alerting system for node events.

  • kube-eventer is an open source tool maintained by ACK for archiving Kubernetes events. It can push cluster events to external systems such as DingTalk, Simple Log Service (SLS), and EventBridge. It also provides filtering capabilities based on event levels. This enables real-time collection, targeted alerting, and asynchronous archiving of events.

Prerequisites

You have created a Kubernetes cluster, such as an Alibaba Cloud ACK cluster or ACK Serverless cluster.

Billing

K8s event center is free of charge if the following conditions are met:

  • The data retention period for the Logstore associated with K8s event center is 90 days (the default value).

  • The volume of data written to K8s event center is less than 256 MB per day, which is approximately 250,000 events.

Examples:

  • If you use the default data retention period of 90 days and your Kubernetes cluster generates 1,000 events per day, K8s event center is free of charge.

  • If you set the data retention period to 105 days and your Kubernetes cluster generates 1,000 events per day, you are charged for Logstore storage after 90 days. The billable item is Log Storage. For more information about the Log Storage billable item, see Billable items in pay-by-feature mode.

Step 1: Deploy kube-eventer and node-problem-detector

ACK

If you use an ACK cluster, you only need to deploy the ack-node-problem-detector component because it integrates the functionalities of both kube-eventer and node-problem-detector. If you use an ACK Serverless cluster, you must deploy the kube-eventer component.

NPD uses configurations and third-party plug-ins to detect node issues and generate corresponding cluster events. A Kubernetes cluster also generates its own events during state transitions, such as pod evictions or image pull failures. The Kubernetes Event Center of Simple Log Service (SLS) centralizes all Kubernetes events in real time and provides storage, query, analysis, visualization, and alerting. To integrate your cluster events with the Kubernetes Event Center, follow these steps:

  • If you selected Install node-problem-detector and Create Event Center during cluster creation, you can skip to Step 2to view the Kubernetes Event Center. For information about how to install the NPD component during cluster creation, see Create an ACK managed cluster.

  • If you did not select Install node-problem-detector and Create Event Center during cluster creation, follow these steps to install it manually.

    1. Log on to the ACK console. In the left navigation pane, click Clusters.

    2. On the Clusters page, click the name of the target cluster. In the left-side navigation pane, choose Operations > Add-ons.

    3. On the Logs and Monitoring tab, find and install ack-node-problem-detector.

Self-managed Kubernetes

  1. Deploy kube-eventer.

    1. Install kubectl. For more information, see Obtain the kubeconfig file of a cluster and use kubectl to connect to the cluster.

    2. Create a configuration file named eventer.yaml based on the following template.

      apiVersion: apps/v1
      kind: Deployment
      metadata:
        labels:
          name: kube-eventer
        name: kube-eventer
        namespace: kube-system
      spec:
        replicas: 1
        selector:
          matchLabels:
            app: kube-eventer
        template:
          metadata:
            labels:
              app: kube-eventer
            annotations:
              scheduler.alpha.kubernetes.io/critical-pod: ''
          spec:
            dnsPolicy: ClusterFirstWithHostNet
            serviceAccount: kube-eventer
            containers:
              - image: registry.cn-hangzhou.aliyuncs.com/acs/kube-eventer:v1.2.5-cc7ec54-aliyun
                name: kube-eventer
                command:
                  - "/kube-eventer"
                  - "--source=kubernetes:https://kubernetes.default"
                  ## .send to sls
                  ## --sink=sls:https://{endpoint}?project={project}&logStore=k8s-event&regionId={region-id}&internal=false&accessKeyId={accessKeyId}&accessKeySecret={accessKeySecret}
                  - --sink=sls:https://cn-beijing.log.aliyuncs.com?project=k8s-xxxx&logStore=k8s-event&regionId=cn-beijing&internal=false&accessKeyId=xxx&accessKeySecret=xxx
                env:
                  # If TZ is assigned, set the TZ value as the time zone
                  - name: TZ
                    value: "Asia/Shanghai"
                volumeMounts:
                  - name: localtime
                    mountPath: /etc/localtime
                    readOnly: true
                  - name: zoneinfo
                    mountPath: /usr/share/zoneinfo
                    readOnly: true
                resources:
                  requests:
                    cpu: 10m
                    memory: 50Mi
                  limits:
                    cpu: 500m
                    memory: 250Mi
            volumes:
              - name: localtime
                hostPath:
                  path: /etc/localtime
              - name: zoneinfo
                hostPath:
                  path: /usr/share/zoneinfo
      ---
      apiVersion: rbac.authorization.k8s.io/v1
      kind: ClusterRole
      metadata:
        name: kube-eventer
      rules:
        - apiGroups:
            - ""
          resources:
            - events
          verbs:
            - get
            - list
            - watch
      ---
      apiVersion: rbac.authorization.k8s.io/v1
      kind: ClusterRoleBinding
      metadata:
        name: kube-eventer
      roleRef:
        apiGroup: rbac.authorization.k8s.io
        kind: ClusterRole
        name: kube-eventer
      subjects:
        - kind: ServiceAccount
          name: kube-eventer
          namespace: kube-system
      ---
      apiVersion: v1
      kind: ServiceAccount
      metadata:
        name: kube-eventer
        namespace: kube-system

      Parameter

      Type

      Required

      Description

      endpoint

      string

      Yes

      The endpoint of Simple Log Service. For more information, see Endpoints.

      project

      string

      Yes

      The Simple Log Service project.

      logStore

      string

      Yes

      The Simple Log Service Logstore.

      internal

      string

      Required for self-managed Kubernetes clusters.

      For a self-managed Kubernetes cluster, you must set this parameter to false.

      regionId

      string

      Required for self-managed Kubernetes clusters.

      The ID of the region where Simple Log Service resides. For more information, see Endpoints.

      accessKeyId

      string

      Required for self-managed Kubernetes clusters.

      The AccessKey ID. We recommend that you use the AccessKey pair of a Resource Access Management (RAM) user. For more information, see AccessKey pair.

      accessKeySecret

      string

      Required for self-managed Kubernetes clusters.

      The AccessKey secret. We recommend that you use the AccessKey pair of a Resource Access Management (RAM) user. For more information, see AccessKey pair.

    3. Run the following command to apply the eventer.yaml configuration to the cluster.

      kubectl apply -f eventer.yaml

      Expected output:

      deployment.apps/kube-eventer created
      clusterrole.rbac.authorization.k8s.io/kube-eventer created
      clusterrolebinding.rbac.authorization.k8s.io/kube-eventer created
      serviceaccount/kube-eventer created
  2. Deploy node-problem-detector.

Step 2: Create a K8s event center instance

Note

After you create a K8s event center instance, Simple Log Service automatically creates a Logstore named k8s-event and related dashboards in the destination project.

  1. Log on to the Simple Log Service console.

  2. In the Log Application section, click the Intelligent O&M tab, and then click K8s Event Center.

  3. On the Event Center Management page, click Add in the upper-right corner.

  4. In the Create Event Center panel, configure the parameters and click Next.

    • If you select Select Existing Project, select an existing project from the Project drop-down list to manage the resources of the K8s event center instance, such as the Logstore and dashboards.

    • If you select Select Kubernetes Cluster from Container Service for Kubernetes, select an existing K8s cluster from the K8s Cluster drop-down list. If you use this method, Simple Log Service automatically creates a project named k8s-log-{cluster-id} to manage the resources of the K8s event center instance, such as the Logstore and dashboards.

Step 3: Use the K8s event center instance

After you create a K8s event center instance and deploy kube-eventer and node-problem-detector, you can start using the event center. You can view the event overview, query event details, view the pod lifecycle, view node events, view core component events, configure alerts, run custom queries, and update the version.

On the K8s Event Center page, find the target K8s event center instance and click the k8s事件中心-002 icon to perform the following operations.

Actions

Description

View event overview

The Event Overview page displays summary statistics of core events. The statistics include the total number of events, a comparison of error events between today and yesterday, alert statistics, error event trends, and pod OOM details.

Note

Pod OOM information does not identify the specific pod. You can locate only the node, process name, and process ID where the event occurred. You can run a custom query to find pod restart events that occur around the time of the pod OOM to help identify the specific pod.

Query event details

The Event Detail Query page displays the details of events filtered by various dimensions, such as event type, event object, host, namespace, and name.

View pod lifecycle

The Pod Lifecycle page displays a graphical timeline of events in a pod's lifecycle. You can also filter important pod events by event level.

View node events

The Node Events page displays node event details, such as the node lifecycle and an event list.

View core component events

The Core Component Events page displays details of core component events, such as ECS restart failures and unimplemented URL modes.

Set up alerts

On the Alert Configuration page, you can configure alerts for K8s event center. For more information, see Set up alerts.

Run custom queries

On the Custom Query page, you can customize query statements and analytic statements.

All events in the K8s event center are stored in a Logstore, so you can use all Logstore features, such as custom queries, event consumption, custom reports, and custom alerts. For more information, see Quick start for query and analysis.

To access the project associated with the K8s event center instance, you can find the project name in one of the following ways:

  • Find the project name in the URL of the Custom Query page. The URL is in the format of https://sls.console.alibabacloud.com/lognext/app/k8s-event/project/k8s-log-xxxx/logsearch/k8s-event. The field after project/ is the project name, for example, k8s-log-xxxx.

  • On the Event Center Management tab, find the target K8s event center instance in the instance list and view its corresponding project name.

Update version

On the Version Update page, you can upgrade K8s event center.

Delete a K8s event center instance

On the K8s Event Center > Event Center Management page, find the instance and click the K8s event center icon in the Actions column.

Sample log

The following code shows a sample log.

hostname:  cn-hangzhou.i-***********"
level:  Normal
pod_id:  2a360760-****
pod_name:  logtail-ds-blkkr
event_id:  {  
   "metadata":{  
      "name":"logtail-ds-blkkr.157b7cc90de7e192",
      "namespace":"kube-system",
      "selfLink":"/api/v1/namespaces/kube-system/events/logtail-ds-blkkr.157b7cc90de7e192",
      "uid":"2aaf75ab-****",
      "resourceVersion":"6129169",
      "creationTimestamp":"2019-01-20T07:08:19Z"
   },
   "involvedObject":{  
      "kind":"Pod",
      "namespace":"kube-system",
      "name":"logtail-ds-blkkr",
      "uid":"2a360760-****",
      "apiVersion":"v1",
      "resourceVersion":"6129161",
      "fieldPath":"spec.containers{logtail}"
   },
   "reason":"Started",
   "message":"Started container",
   "source":{  
      "component":"kubelet",
      "host":"cn-hangzhou.i-***********"
   },
   "firstTimestamp":"2019-01-20T07:08:19Z",
   "lastTimestamp":"2019-01-20T07:08:19Z",
   "count":1,
   "type":"Normal",
   "eventTime":null,
   "reportingComponent":"",
   "reportingInstance":""
}

log field

Type

Description

hostname

string

The hostname of the host on which the event occurred.

level

string

The log level. Valid values: Normal and Warning.

pod_id

string

The unique ID of the pod. This field is included only if the event is related to a pod.

pod_name

string

The name of the pod. This field is included only if the event is related to a pod.

event_id

json

The details of the event. The value of this field is a JSON string.

FAQ

A K8s event center instance has no data

After you deploy a K8s event center instance, new events are automatically collected. You can search for them on the Custom Query page. We recommend that you set the time range in the upper-right corner to 1 Day. If no data is found, there are usually two causes:

  • No new events are generated in the Kubernetes cluster since you deployed K8s event center.

    You can run the kubectl get events --all-namespaces command to check whether new events are generated in the cluster.

  • The parameters are incorrectly configured in your deployment of kube-eventer and node-problem-detector.

    • If you use a Container Service for Kubernetes (ACK) cluster, perform these steps:

      1. Log on to the ACK console.

      2. On the Clusters page, click the name of the target cluster.

      3. In the left-side navigation pane, choose Apply > Helm.

      4. On the Helm page, find ack-node-problem-detector and click Update.

      5. Check and modify the parameter settings. For more information, see Step 1: Deploy kube-eventer and node-problem-detector.

    • If you use a self-managed Kubernetes cluster, see Collect Kubernetes events for the parameter settings.

How do I view the container logs for an event?

  • If you use a Container Service for Kubernetes (ACK) cluster, perform these steps:

    1. Log on to the ACK console.

    2. On the Clusters page, click the name of the target cluster.

    3. In the left-side navigation pane, choose Workloads > Pods.

    4. Set Namespace to kube-system.

    5. In the Pods list, find the target pod and click Log.

  • If you use a self-managed Kubernetes cluster, check the logs of the Pods with the filename prefix eventer-sls in the kube-system namespace.