Add documentation for using Jaeger with Istio (#437)

This commit is contained in:
Gary Brown 2017-09-07 04:55:23 +01:00 committed by Shriram Rajagopalan
parent fb38bd942b
commit 39be9cbfe5
4 changed files with 79 additions and 18 deletions

View File

@ -1,6 +1,6 @@
---
title: Distributed Request Tracing
overview: How to configure the proxies to send tracing requests to Zipkin
title: Distributed Tracing
overview: How to configure the proxies to send tracing requests to Zipkin or Jaeger
order: 120
@ -10,7 +10,7 @@ type: markdown
{% include home.html %}
This task shows you how Istio-enabled applications
can be configured to collect trace spans using [Zipkin](http://zipkin.io).
can be configured to collect trace spans using [Zipkin](http://zipkin.io) or [Jaeger](https://uber.github.io/jaeger/).
After completing this task, you should understand all of the assumptions about your
application and how to have it participate in tracing, regardless of what
language/framework/platform you use to build your application.
@ -23,17 +23,25 @@ example application for this task.
* Setup Istio by following the instructions in the [Installation guide](./installing-istio.html).
If you didn't start the Zipkin addon during installation,
If you didn't start the Zipkin or Jaeger addon during installation,
you can run the following command to start it now:
```bash
kubectl apply -f install/kubernetes/addons/zipkin.yaml
```
for Zipkin, or
```bash
kubectl apply -f https://raw.githubusercontent.com/jaegertracing/jaeger-kubernetes/master/all-in-one/jaeger-all-in-one-template.yml
```
for Jaeger.
* Deploy the [BookInfo]({{home}}/docs/samples/bookinfo.html) sample application.
## Accessing the Zipkin dashboard
## Accessing the dashboard
### Zipkin
Setup access to the Zipkin dashboard URL using port-forwarding:
@ -43,25 +51,35 @@ kubectl port-forward $(kubectl get pod -l app=zipkin -o jsonpath='{.items[0].met
Then open your browser at [http://localhost:9411](http://localhost:9411)
### Jaeger
Setup access to the Jaeger dashboard URL using port-forwarding:
```bash
kubectl port-forward $(kubectl get pod -l app=jaeger -o jsonpath='{.items[0].metadata.name}') 16686:16686 &
```
Then open your browser at [http://localhost:16686](http://localhost:16686)
## Generating traces using the BookInfo sample
With the BookInfo application up and running, generate trace information by accessing
`http://$GATEWAY_URL/productpage` one or more times.
If you now look at the Zipkin dashboard, you should see something similar to the following:
If you now look at the dashboard, you should see something similar to the following:
<figure><img style="max-width:100%" src="./img/zipkin_dashboard.png" alt="Zipkin Istio Dashboard" title="Zipkin Istio Dashboard" />
<figcaption>Zipkin Istio Dashboard</figcaption></figure>
<img style="max-width:50%" width="425" src="./img/zipkin_dashboard.png" alt="Zipkin Dashboard" title="Zipkin Dashboard" /> <img style="max-width:50%" width="425" src="./img/jaeger_dashboard.png" alt="Jaeger Dashboard" title="Jaeger Dashboard" />
_(Zipkin on the left, Jaeger on the right)_
If you click on the top (most recent) trace, you should see the details corresponding to your
latest refresh of the `/productpage`.
The page should look something like this:
<figure><img style="max-width:100%" src="./img/zipkin_span.png" alt="Zipkin Istio Dashboard" title="Zipkin Istio Dashboard" />
<figcaption>Zipkin Istio Dashboard</figcaption></figure>
<img style="max-width:50%" width="425" src="./img/zipkin_span.png" alt="Zipkin Trace View" title="Zipkin Trace View" /> <img style="max-width:50%" width="425" src="./img/jaeger_trace.png" alt="Jaeger Trace View" title="Jaeger Trace View" />
_(Zipkin on the left, Jaeger on the right)_
As you can see, there are 4 spans (only 3, if version v1 of the `reviews` service was used),
As you can see, the trace is comprised of spans,
where each span corresponds to a BookInfo service invoked during the execution of a `/productpage` request.
Although every service has the same label, `istio-proxy`, because the tracing is being done by
the Istio sidecar (Envoy proxy) which wraps the call to the actual service,
@ -75,8 +93,8 @@ The `reviews` service took about 243ms to execute, including a 15ms call to `rat
## Understanding what happened
Although Istio proxies are able to automatically send spans to Zipkin, they need some hints to tie together the entire trace.
Applications need to propagate the appropriate HTTP headers so that when the proxies send span information to Zipkin,
Although Istio proxies are able to automatically send spans, they need some hints to tie together the entire trace.
Applications need to propagate the appropriate HTTP headers so that when the proxies send span information to Zipkin or Jaeger,
the spans can be correlated correctly into a single trace.
To do this, an application needs to collect and propagate the following headers from the incoming request to any outgoing requests:

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -164,20 +164,33 @@ After running some services -- for example, after installing the [BookInfo]({{ho
<figcaption>BookInfo Service Graph</figcaption></figure>
### Enabling request tracing with Zipkin
### Enabling distributed tracing
To enable and view distributed request tracing, install the [Zipkin](http://zipkin.io) addon:
Distributed tracing can be used to analyze the request flow and timing of an Istio application and to help identify bottlenecks.
Istio supports the following distributed tracing systems. You can find out more about how to access the dashboards and use these tracing systems in [Distributed Tracing]({{home}}/docs/tasks/distributed-tracing.html).
#### Zipkin
To enable and view distributed request tracing using the [Zipkin](http://zipkin.io) addon:
```bash
kubectl apply -f install/kubernetes/addons/zipkin.yaml
```
Zipkin can be used to analyze the request flow and timing of an Istio application and to help identify bottlenecks. You can find out more about how to access the Zipkin dashboard and use Zipkin in [Distributed Request Tracing]({{home}}/docs/tasks/zipkin-tracing.html).
#### Jaeger
To enable and view distributed request tracing using the [Jaeger](https://uber.github.io/jaeger/) addon:
```bash
kubectl apply -f https://raw.githubusercontent.com/jaegertracing/jaeger-kubernetes/master/all-in-one/jaeger-all-in-one-template.yml
```
## Verifying the installation
1. Ensure the following Kubernetes services were deployed: "istio-pilot", "istio-mixer", "istio-ingress", "istio-egress",
"istio-ca" (if Istio Auth is enabled), and, optionally, "grafana", "prometheus', "servicegraph" and "zipkin".
"istio-ca" (if Istio Auth is enabled), and, optionally, "grafana", "prometheus', "servicegraph" and "zipkin" (or "jaeger-*").
```bash
kubectl get svc
@ -192,16 +205,30 @@ Zipkin can be used to analyze the request flow and timing of an Istio applicatio
kubernetes 10.83.240.1 <none> 443/TCP 36d
prometheus 10.83.247.221 <none> 9090:30398/TCP 5h
servicegraph 10.83.242.48 <none> 8088:31928/TCP 5h
```
If zipkin is installed as an addon,
```bash
zipkin 10.83.241.77 <none> 9411:30243/TCP 5h
```
If jaeger is installed as an addon,
```bash
jaeger-agent None <none> 5775/UDP,6831/UDP,6832/UDP 5h
jaeger-collector 10.0.0.104 <none> 14267/TCP,14268/TCP,9411/TCP 5h
jaeger-query 10.0.0.199 <pending> 80:32328/TCP 5h
zipkin None <none> 9411/TCP 5h
```
Note that if your cluster is running in an environment that does not support an external load balancer
(e.g., minikube), the `EXTERNAL-IP` of `istio-ingress` will say `<pending>` and you will need to access the
application using the service NodePort or port-forwarding instead.
2. Check the corresponding Kubernetes pods were deployed and all containers are up and running:
"istio-pilot-\*", "istio-mixer-\*", "istio-ingress-\*", "istio-egress-\*", "istio-ca-\*" (if Istio Auth is enabled),
and, optionally, "grafana-\*", "prometheus-\*', "servicegraph-\*" and "zipkin-\*".
and, optionally, "grafana-\*", "prometheus-\*', "servicegraph-\*" and "zipkin-\*"/"jaeger-\*".
```bash
kubectl get pods
@ -215,9 +242,20 @@ Zipkin can be used to analyze the request flow and timing of an Istio applicatio
istio-mixer-2104784889-20rm8 1/1 Running 0 5h
prometheus-3067433533-wlmt2 1/1 Running 0 5h
servicegraph-3127588006-pc5z3 1/1 Running 0 5h
```
If zipkin is installed as an addon,
```bash
zipkin-4057566570-k9m42 1/1 Running 0 5h
```
If jaeger is installed as an addon,
```bash
jaeger-deployment-1058555976-w6fw8 1/1 Running 0 5h
```
## Deploy your application
You can now deploy your own application, or one of the sample applications provided with the installation,
@ -269,6 +307,11 @@ You can use the [Istio Helm chart](https://github.com/kubernetes/charts/tree/mas
```bash
kubectl delete -f install/kubernetes/addons/
```
and, if Jaeger was installed,
```bash
kubectl delete -f https://raw.githubusercontent.com/jaegertracing/jaeger-kubernetes/master/all-in-one/jaeger-all-in-one-template.yml
```
4. Delete Istio Kubernetes [TPRs](https://kubernetes.io/docs/tasks/access-kubernetes-api/extend-api-third-party-resource):