You can enable tracing for NGINX Ingress Controller deployed in a Container Service for Kubernetes (ACK) cluster, and import trace data to Managed Service for OpenTelemetry. Then, you can view traces and topology in Managed Service for OpenTelemetry to troubleshoot issues related to NGINX Ingress Controller. This topic describes how to enable tracing for NGINX Ingress Controller.
Prerequisites
Managed Service for OpenTelemetry is activated and granted required permissions. For more information, see Activate services and grant permissions.
An ACK managed cluster is created. For more information, see Create an ACK managed cluster.
Step 1: Obtain an endpoint from Managed Service for OpenTelemetry
Select a client to obtain an endpoint based on your requirements. In this example, a Zipkin client is used.
Log on to the Managed Service for OpenTelemetry console.
In the left-side navigation pane, click Cluster Configurations. In the top navigation bar, select a region. Then, click the Access point information tab
NoteThe region that you select must be the same as the region of the cluster used in Step 2: Enable Managed Service for OpenTelemetry for an Ingress in the ACK console.
On the Access point information tab, turn on Show Token. Click Zipkin. In the Related Information column of the table, click the copy icon next to the value of Access point of Alibaba Cloud vpc in the v1 endpoint section.
NoteThe NGINX Ingress controller is deployed on Alibaba Cloud and resides in the same region as the endpoint of Managed Service for OpenTelemetry. Therefore, we recommend that you use a VPC endpoint. Otherwise, use a public endpoint.
Step 2: Enable Managed Service for OpenTelemetry for an Ingress in the ACK console
Log on to the ACK console. In the left-side navigation pane, click Clusters.
On the Clusters page, find the cluster that you want to manage and click its name. In the left-side navigation pane, choose .
In the upper part of the ConfigMap page, select kube-system from the Namespace drop-down list, enter nginx-configuration in the Name search box, and then click Edit in the Actions column of the search result.
Configure Zipkin as the tracing analysis client.
In the Edit panel, click Add. Enter zipkin-collector-host in the Name field and enter the endpoint that is obtained in Step 1: Obtain the endpoint from Managed Service for OpenTelemetry in the Value field.
ImportantYou must delete
http://
at the beginning of the endpoint and add a question mark (?) at the end of the endpoint. Example:Original endpoint:
http://tracing-analysis-dc-hz-internal.aliyuncs.com/adapt_******_******/api/v1/spans
Modified endpoint:
tracing-analysis-dc-hz-internal.aliyuncs.com/adapt_******_******/api/v1/spans?
Enable the tracing analysis feature.
In the Edit panel, click Add. Enter enable-opentracing in the Name field and enter true in the Value field. Then, click OK.
Step 3: View trace data
Use the ARMS console
- Log on to the ARMS console.
In the left-side navigation pane, choose
.In the top navigation bar of the Applications page, select a region and click the nginx application.
In the left-side navigation pane of the details page, click Interface Invocation. In the right-side section of the Interface Calls page, view the information about traces.
On the Overview tab, view the topology.
Click the Traces tab to view the top 100 traces that consume the most amount of time for the application. For more information, see API calls.
On the Traces tab, find a trace that you want to view and click its ID to view the details of the trace.
Use the Managed Service for OpenTelemetry console
Log on to the Managed Service for OpenTelemetry console.
In the left-side navigation pane, click Applications.
On the Applications page, select a region in the top navigation bar, find the nginx application, and then click the application name. The details page of the application appears.
In the left-side navigation pane of the details page, click Interface Invocation. In the right-side section of the Interface Calls page, view the information about traces.
On the Overview tab, view the topology.
Click the Traces tab to view the top 100 traces that consume the most amount of time for the application. For more information, see API calls.
On the Traces tab, find a trace that you want to view and click its ID to view the details of the trace.
References
For more information about Managed Service for OpenTelemetry, see What is Managed Service for OpenTelemetry?
For more information about ACK, see What is ACK?
To use different tracing clients, such as Zipkin, Jaeger, and SkyWalking, you must configure different parameters in the nginx-configuration ConfigMap of ACK. In this example, Zipkin is used.Managed Service for OpenTelemetry For more information about how to access Managed Service for OpenTelemetry, see Preparations.