4 min • read

Distributed tracing with Zipkin

In this tutorial, we'll configure Emissary-ingress to initiate a trace on some sample requests, and use Zipkin to visualize them.

Before you get started

This tutorial assumes you have already followed Emissary-ingress Getting Started guide. If you haven't done that already, you should do that now.

After completing the Getting Started guide you will have a Kubernetes cluster running Emissary-ingress and the Quote service. Let's walk through adding tracing to this setup.

1. Deploy Zipkin

In this tutorial, you will use a simple deployment of the open-source Zipkin distributed tracing system to store and visualize Emissary-ingress-generated traces. The trace data will be stored in memory within the Zipkin container, and you will be able to explore the traces via the Zipkin web UI.

First, add the following YAML to a file named zipkin.yaml. This configuration will create a Zipkin Deployment that uses the openzipkin/zipkin container image and also an associated Service. We will also include a TracingService that configures Emissary-ingress to use the Zipkin service (running on the default port of 9411) to provide tracing support.

Next, deploy this configuration into your cluster:

As a final step we want to restart Emissary-ingress as this is necessary to add the tracing header. This command will restart all the Pods (assuming Emissary-ingress is installed in the ambassador namespace):

2. Generate some requests

Use curl to generate a few requests to an existing Emissary-ingress Mapping. You may need to perform many requests since only a subset of random requests are sampled and instrumented with traces.

3. Test traces

To test things out, we'll need to access the Zipkin UI. If you're on Kubernetes, get the name of the Zipkin pod:

And then use kubectl port-forward to access the pod:

Open your web browser to http://localhost:9411 for the Zipkin UI.

If you're on minikube you can access the NodePort directly, and this ports number can be obtained via the minikube services list command. If you are using Docker for Mac/Windows, you can use the kubectl get svc command to get the same information.

Open your web browser to the Zipkin dashboard http://192.168.99.107:31043/zipkin/.

In the Zipkin UI, click on the "Find Traces" button to get a listing instrumented traces. Each of the traces that are displayed can be clicked on, which provides further information about each span and associated metadata.

Learn more

For more details about configuring the external tracing service, read the documentation on external tracing.