K8s Event Center records the status changes of Kubernetes clusters. For example, K8s Event Center records a status change when you create, run, or delete a pod, or when a component exception occurs. K8s Event Center aggregates all the events in Kubernetes clusters in real time. This allows you to perform various operations on the events. For example, you can store, query, analyze, and visualize event data and configure alerts for the events. This topic describes how to create and use an event center in K8s Event Center.

Billing

If the following conditions are met, you are not charged when you use an event center:
  • The data retention period of the Logstore that is associated with your event center is 90 days, which is the default value.
  • The amount of data that is written to your event center per day is less than 256 MB, which is equivalent to approximately 250,000 events.
Examples:
  • If the default data retention period is specified for the associated Logstore and 1,000 events are generated in your Kubernetes cluster per day, you can use your event center for free.
  • If you change the data retention period to 105 days and 1,000 events are generated in your Kubernetes cluster per day, you are charged only for the data that is stored in the associated Logstore for a period that exceeds 90 days. The fee is calculated based on the billable item of the storage space occupied by log data. For more information about the billable item, see Billable items.

Step 1: Create an event center

  1. Log on to the Log Service console.
  2. In the Log Application section, click the Intelligent O&M tab and click K8s Event Center.
  3. On the Event Center Management tab, click Add.
  4. In the Add Event Center panel, configure the parameters.
    • If you select Existing Project, you can select an existing project from the Project drop-down list to manage the resources of your event center. The resources include a Logstore and the related dashboards.
    • If you select Kubernetes Cluster, you can select an existing Kubernetes cluster from the Kubernetes Cluster drop-down list. If you use this method to create an event center, Log Service automatically creates a project whose name is in the k8s-log-{cluster-id} format to manage the resources of your event center. The resources include a Logstore and the related dashboards.
    Note After you create an event center, Log Service automatically creates a Logstore named k8s-event in the specified project. Associated dashboards are also created for the event center.
  5. Click Next.

Step 2: Deploy the eventer and node-problem-detector components

Before you can use an event center, you must deploy the eventer and node-problem-detector components in your Kubernetes cluster.

  • Deploy the eventer and node-problem-detector components in a Container Service for Kubernetes (ACK) cluster

    The ack-node-problem-detector component that is provided in the Marketplace of ACK is integrated with the features of the eventer and node-problem-detector components. Therefore, to deploy the eventer and node-problem-detector components in an ACK cluster, you need only to deploy the ack-node-problem-detector component. For more information about how to deploy the ack-node-problem-detector component, see Event monitoring.

    1. Log on to the ACK console.
    2. In the left-side navigation pane, choose Marketplace > Marketplace.
    3. On the App Catalog tab, search for and click ack-node-problem-detector.
    4. Click Deploy.
    5. In the Basic Information step, select your cluster and click Next.
    6. In the Parameters step, set the parameters of the eventer node and click OK.
      • enabled: Set the value of the enabled parameter under eventer > sinks > sls to true.
      • topic: Optional. Set the value to your cluster name. The name can contain lowercase letters, underscores (_), and hyphens (-).
      • project: Set the value to the name of the project that is specified when you create the event center.
      • logstore: Set the value to k8s-event.
        sinks:
           sls:
             enabled: true
             # If you want the monitoring results to be notified by sls, set enabled to true.
             topic: "my-cluster"
             project:  "{sls-project-name}"
             # You can view the project information by logging in to the
             # SLS console. Please fill in the name of the project here.
             # eg: your project name is k8s-log-cc18a5f3443dhdss22654da,
             # then you can fill k8s-log-cc18a5f3443dhdss22654da to project label.
             logstore: "k8s-event"
             # You can view the project information by logging in to the
             # SLS console. Please fill the logstore address in here.
  • Deploy the eventer and node-problem-detector components in a self-managed Kubernetes cluster
    1. Deploy the eventer component. For more information, see Collect Kubernetes events.
    2. Deploy the node-problem-detector component. For more information, visit GitHub.

Step 3: Use an event center

After you create an event center in K8s Event Center and deploy the eventer and node-problem-detector components, you can use the event center. For example, you can use the event center to view event statistics, query event details, view the lifecycle of a pod, view node events, view core component events, configure alerts, perform custom queries, and update the version of K8s Event Center.

In the left-side navigation pane of the K8s Event Center page, find the event center that you want to manage and click the K8s Event Center-002 icon. Then, you can perform the following operations.

Operation Description
View event statistics The Event Overview tab displays the statistics of core events. The statistics include the total number of events, the difference between the number of error events within the current day and the preceding day, statistics of alert items, trends of error events, and details of pod OOM events.
Note If a pod OOM event is recorded, you can view only the node on which the event occurs, process name, and process ID. The pod in which the event occurs cannot be located. However, you can query the pod restart event that occurs around the time of the pod OOM event. This way, you can locate the pod.
Query event details The Event Details tab displays the details about the events that are returned by using different filter conditions, such as the event type, event destination, host, namespace, and name.
View the lifecycle of a pod The Pod Lifecycle tab displays the details about the events that occur within the lifecycle of a pod. You can filter important pod events by event level.
View node events The Node Event tab displays the details about node events. You can view the lifecycle of a node and the events that occur on the node.
View core component events The Event Core tab displays the details about core component events. The events include NLC.Task.RestartECS.Fail and NLC.Task.URL.Mode.Unimplemented.
Configure alerts On the page that appears after you click Alert Configuration, you can configure alerts for your event center. For more information, see Configure alerts.
Perform custom queries On the page that appears after you click Custom Query, you can execute custom query statements.

All events in an event center are stored in a Logstore. You can use all features of the Logstore. For example, you can perform custom queries, consume event data, create custom reports, or configure custom alerts. For more information, see Query and analyze logs.

If you want to access a project that is specified for an event center, you can obtain the name of the project by using one of the following methods:
Update the version of K8s Event Center On the page that appears after you click Version Update, you can update the version of K8s Event Center.

Delete an event center

On the K8s Event Center > Event Center Management page, find the event center that you want to delete and click the K8s Event Center icon in the Actions column.

FAQ

  • Why does no data exist in my event center?
    After you deploy an event center, new events are automatically collected to the event center. You can click Custom Query to search for the events. We recommend that you set the time range in the upper-right corner to 1 Day. Data may not be found in the event center due to the following reasons:
    • After you deploy the event center, no events are generated in the associated Kubernetes cluster.

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

    • Invalid values are specified for the parameters that are used to deploy the eventer and node-problem-detector components.
      • If you are using an ACK cluster, perform the following steps:
        1. Log on to the ACK console.
        2. On the Clusters page, find the cluster that you want to manage and click the name of the cluster.
        3. In the left-side navigation pane, choose Applications > Helm.
        4. On the Helm page, find ack-node-problem-detector and click Update in the Actions column.
        5. Check and modify the parameter settings. For more information, see Step 2: Deploy the eventer and node-problem-detector components.
      • If you are using a self-managed Kubernetes cluster, check the configurations based on the descriptions in Collect Kubernetes events.
  • How do I view the logs of a container in which an event occurs?
    • If you are using an ACK cluster, perform the following steps:
      1. Log on to the ACK console.
      2. On the Clusters page, find the cluster that you want to manage and click the name of the cluster.
      3. In the left-side navigation pane, choose Workloads > Pods.
      4. Set the Namespace parameter to kube-system.
      5. On the Pods page, find the pod that you want to manage and click Logs in the Actions column.
    • If you are using a self-managed Kubernetes cluster, filter the kube-system namespace and find the file whose name is prefixed with eventer-sls to view the pod logs.