The stability of Ingresses, which function as resource objects at the access layer in clusters, affects service quality. This topic describes best practices for monitoring custom Nginx Ingress controllers in clusters.
VKE allows you to deploy multiple independent Nginx Ingress controllers within a cluster. Each controller operates independently.
- System default ingress-nginx: Deploy the ingress-nginx add-on in the cluster add-on center and follow the on-screen prompts to complete installation. For details, see Installing ingress-nginx.
By default, the logs of custom Nginx Ingress controllers are not collected or persistently stored. You need to configure and enable log collection to achieve persistent collection, storage, and query of the logs for custom Nginx Ingress controllers.
- A log project and log topic have been created in TLS. For detailed operations, see Log projects and Log topics.
Configuring log collection
- In the left navigation bar, click Cluster.
- On the Cluster page, click the name of the target cluster.
- In the left navigation bar of the cluster management page, click Log management.
- Click the Log collection rule tab and click Create collection rule. On the page that appears, configure log collection for the custom Nginx Ingress controller.
- Configure the log storage location, including IAM project, Project, and Topic. After you complete the configuration, click Next step: Collection rule.
- Configure the log collection rule.
- Keep the default values for other parameters. After you complete the configuration, click Next step: Check the index configuration.
- Configure log index checking. In this example, keep the default configurations.
- Click Create collection configuration to complete the configuration.
- In the left navigation bar of the cluster management page, click Log management.
- Click the Container log tab. Select the target log project and log topic to view the logs of the custom Nginx Ingress controller.
You can enable the cloud-native observability feature in the cluster to achieve monitoring and alerting for the custom Nginx Ingress controller.
Configuring metric collection
- (Optional) Configure service discovery.
tip
- If your custom Nginx Ingress controller is deployed in the kube-system namespace, you can directly view the metrics and dashboard of the instance without the need to configure service discovery.
- If your custom Nginx Ingress controller is deployed in other namespaces, you need to configure service discovery to view the metrics and dashboard of the instance.
- In the left navigation bar of the cluster management page, click Services and Ingresses > Service. On the page that appears, select the target namespace from the Namespace drop-down list.
- In the service list, select the service named *-ingress-nginx-controller-metrics. * indicates the name that you define. In this example, the service name is nginx-ingress-nginx-controller-metrics.
- In the Actions column, click ... > Update to configure the following annotations for the service to enable service discovery.
- In the left navigation bar of the cluster management page, click Monitoring > Dashboard.
- In the left dashboard list, click Network services monitoring > Ingres-nginx monitoring to view the monitoring dashboard.
- From the Namespace drop-down list, select the namespace where the Ingress is located.
- From the IngressClass drop-down list, select the type of Ingress. Supported types include the system default ingress-nginx and custom Nginx Ingress Controller.
- From the Pod drop-down list, specify a pod.
VMP allows you to configure resource alerting policies. You can configure alerts in the console by using Ingress service observability. When monitoring data reaches the threshold and triggers an alert, the system sends detailed information, such as the alert resources, fault type, current value, and alert duration, to alert contacts. VMP supports various alert notification methods, such as email, Feishu, DingTalk, and phone. For detailed configuration methods, see the following topics: