How does the Kubernetes cluster use the event center
Event monitoring is another monitoring method in Kubernetes, which can make up for the lack of real-time, accuracy and scenario of resource monitoring. You can monitor the exceptions and problems of the cluster in real time by using NPD in combination with the Kubernetes event center of SLS, configuring the NPD cluster check items and exception event offline function, using nails, using SLS offline Kubernetes events, and using EventBridge offline Kubernetes events.
Background information
The architecture design of Kubernetes is based on the state machine. The transition between different states will generate corresponding events, the transition between normal states will generate events of Normal level, and the transition between normal and abnormal states will generate events of Warning level.
ACK provides out-of-the-box container scenario event monitoring scheme, and provides container event monitoring capability through the NPD (node-problem-detector) maintained by ACK and kube-event included in NPD.
• NPD (node-problem-detector) is a tool for Kubernetes node diagnosis. It can convert node exceptions, such as Docker Engine Hang, Linux Kernel Hang, network outgoing exceptions, and file descriptor exceptions, into node events. Combined with kube-event, it can realize the closed-loop of node event alarm. For more information, see NPD.
• kube-event is an open source Kubernetes event offline tool maintained by ACK, which can offline cluster events to systems such as nailing, SLS, and EventBridge, and provide different levels of filtering conditions to achieve real-time event collection, directional alarm, and asynchronous archiving. For more information, see kube-event.
Use NPD and SLS's Kubernetes event center to monitor cluster events
NPD detects node problems or failures based on the configuration and third-party plug-ins, and generates corresponding cluster events. The Kubernetes cluster itself will also generate various events due to the change of cluster state. For example, Pod eviction, image pull failure and other exceptions. The Kubernetes event center of the log service SLS (Log Service) gathers all events in Kubernetes in real time and provides storage, query, analysis, visualization, alarm and other capabilities. The operation steps for connecting cluster events to the Kubernetes event center of the log service are as follows.
prerequisite
• You need to create a registered cluster and connect the self-built Kubernetes cluster to the registered cluster. For details, see Creating an AliCloud registration cluster and accessing the self-built Kubernetes cluster.
Step 1: Configure RAM permissions of event center components in the self-built cluster
Before installing components in the registration cluster, you need to set the permissions of AK to access cloud services in the access cluster. Before setting AK, you need to create RAM users and add permissions to access relevant cloud resources.
1. Create RAM user. For specific steps on how to create RAM users, see Creating RAM Users.
2. Create a permission policy. For specific steps to create a permission policy, see Creating a Custom Policy. Please authorize the AliyunCSManagedLogRolePolicy policy of RAM.
3. Add permissions for RAM users. For specific steps on how to authorize RAM users, see Authorizing RAM Users.
4. Create AK for RAM users. For how to create an AK for a sub-account, see Getting AccessKey.
5. Use AK to create a secret resource named alibaba-addon-secret in the self-built Kubernetes cluster. In step 2, when installing the relevant components of the event center, this AK will be automatically referenced to access the corresponding cloud service resources.
You need to replace the above code and with the AK information you obtained.
Step 2: Install and view the event center.
Please follow the steps below to install and view the Kubernetes event center.
1. Log in to the container service management console.
2. In the left navigation bar of the console, click Cluster.
3. On the cluster list page, click the target cluster name or the details under the operation column on the right of the target cluster.
4. Select Operation and Maintenance Management>Event Center>Event Overview, and click Create Time Center.
5. Click the event center management tab, and in the left navigation bar of the K8s event center page, click the expansion icon on the left of the target cluster name to view the relevant information of the Kubernetes event center. You can view the overview and details of Kubernetes events, the life cycle of Pod, and customize the query and alarm configuration.
Background information
The architecture design of Kubernetes is based on the state machine. The transition between different states will generate corresponding events, the transition between normal states will generate events of Normal level, and the transition between normal and abnormal states will generate events of Warning level.
ACK provides out-of-the-box container scenario event monitoring scheme, and provides container event monitoring capability through the NPD (node-problem-detector) maintained by ACK and kube-event included in NPD.
• NPD (node-problem-detector) is a tool for Kubernetes node diagnosis. It can convert node exceptions, such as Docker Engine Hang, Linux Kernel Hang, network outgoing exceptions, and file descriptor exceptions, into node events. Combined with kube-event, it can realize the closed-loop of node event alarm. For more information, see NPD.
• kube-event is an open source Kubernetes event offline tool maintained by ACK, which can offline cluster events to systems such as nailing, SLS, and EventBridge, and provide different levels of filtering conditions to achieve real-time event collection, directional alarm, and asynchronous archiving. For more information, see kube-event.
Use NPD and SLS's Kubernetes event center to monitor cluster events
NPD detects node problems or failures based on the configuration and third-party plug-ins, and generates corresponding cluster events. The Kubernetes cluster itself will also generate various events due to the change of cluster state. For example, Pod eviction, image pull failure and other exceptions. The Kubernetes event center of the log service SLS (Log Service) gathers all events in Kubernetes in real time and provides storage, query, analysis, visualization, alarm and other capabilities. The operation steps for connecting cluster events to the Kubernetes event center of the log service are as follows.
prerequisite
• You need to create a registered cluster and connect the self-built Kubernetes cluster to the registered cluster. For details, see Creating an AliCloud registration cluster and accessing the self-built Kubernetes cluster.
Step 1: Configure RAM permissions of event center components in the self-built cluster
Before installing components in the registration cluster, you need to set the permissions of AK to access cloud services in the access cluster. Before setting AK, you need to create RAM users and add permissions to access relevant cloud resources.
1. Create RAM user. For specific steps on how to create RAM users, see Creating RAM Users.
2. Create a permission policy. For specific steps to create a permission policy, see Creating a Custom Policy. Please authorize the AliyunCSManagedLogRolePolicy policy of RAM.
3. Add permissions for RAM users. For specific steps on how to authorize RAM users, see Authorizing RAM Users.
4. Create AK for RAM users. For how to create an AK for a sub-account, see Getting AccessKey.
5. Use AK to create a secret resource named alibaba-addon-secret in the self-built Kubernetes cluster. In step 2, when installing the relevant components of the event center, this AK will be automatically referenced to access the corresponding cloud service resources.
You need to replace the above code and with the AK information you obtained.
Step 2: Install and view the event center.
Please follow the steps below to install and view the Kubernetes event center.
1. Log in to the container service management console.
2. In the left navigation bar of the console, click Cluster.
3. On the cluster list page, click the target cluster name or the details under the operation column on the right of the target cluster.
4. Select Operation and Maintenance Management>Event Center>Event Overview, and click Create Time Center.
5. Click the event center management tab, and in the left navigation bar of the K8s event center page, click the expansion icon on the left of the target cluster name to view the relevant information of the Kubernetes event center. You can view the overview and details of Kubernetes events, the life cycle of Pod, and customize the query and alarm configuration.
Related Articles
-
A detailed explanation of Hadoop core architecture HDFS
Knowledge Base Team
-
What Does IOT Mean
Knowledge Base Team
-
6 Optional Technologies for Data Storage
Knowledge Base Team
-
What Is Blockchain Technology
Knowledge Base Team
Explore More Special Offers
-
Short Message Service(SMS) & Mail Service
50,000 email package starts as low as USD 1.99, 120 short messages start at only USD 1.00