Skip to content

Commit

Permalink
Update distributed tracing task to use Tracing Add-On (kubernetes#725)
Browse files Browse the repository at this point in the history
* update distributed-tracing task to use add-ons

Signed-off-by: Tarun Pothulapati <[email protected]>

* add integration with jaeger and image

Signed-off-by: Tarun Pothulapati <[email protected]>

* fix env of application

Signed-off-by: Tarun Pothulapati <[email protected]>

Co-authored-by: Thomas Rampelberg <[email protected]>
  • Loading branch information
Pothulapati and grampelberg authored Jun 9, 2020
1 parent 8bd1b6f commit 75a02c4
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 29 deletions.
76 changes: 47 additions & 29 deletions linkerd.io/content/2/tasks/distributed-tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,48 +31,57 @@ topology that looks like:
Follow the [Installing Linkerd Guide](/2/tasks/install/) if you haven't
already done this.

## Install the collector
## Install Trace Collector & Jaeger

The first step of getting distributed tracing setup is installing a collector
onto your cluster. This component consists of "receivers" that consume spans
emitted from the mesh and your applications as well as "exporters" that convert
spans and forward them to a backend. To add the [OpenCensus
Collector](https://opencensus.io/service/components/collector/) to your cluster,
run:

```bash
kubectl apply -f https://run.linkerd.io/tracing/collector.yml
```
spans and forward them to a backend.

You will now have a `tracing` namespace that contains the collector running as
part of the mesh. It has been configured to:
Next, we will need [Jaeger](https://www.jaegertracing.io/) in your cluster.
The [all inone](https://www.jaegertracing.io/docs/1.8/getting-started/#all-in-one)
configuration will store the traces, make them searchable and provide
visualization of all the data being emitted.

- Receive spans from OpenCensus clients
- Export spans to a Jaeger backend
Linkerd now has add-ons which enables users to install extra components that
integrate well with Linkerd. Tracing is such one add-on which includes [OpenCensus
Collector](https://opencensus.io/service/components/collector/) and
[Jaeger](https://www.jaegertracing.io/)

The collector is extremely configurable and can use the
[receiver](https://opencensus.io/service/receivers/) or
[exporter](https://opencensus.io/service/exporters/) of your choice.
To add the Tracing Add-On to your cluster,
run:

Before moving onto the next step, make sure everything is up and running with
`kubectl`:
First, we would need a configuration file where we enable the Tracing Add-On.

```bash
kubectl -n tracing rollout status deploy/oc-collector
cat >> config.yaml << EOF
tracing:
enabled: true
EOF
```

## Install Jaeger
This configuration file can also be used to apply Add-On configuration
(not just specific to tracing Add-On). More information on the configuration
fields allowed, can be found [here](https://github.com/linkerd/linkerd2/tree/master/charts/linkerd2#add-ons-configuration)

With a running collector, it is now time to add
[Jaeger](https://www.jaegertracing.io/) to your cluster. The [all in
one](https://www.jaegertracing.io/docs/1.8/getting-started/#all-in-one)
configuration will store the traces, make them searchable and provide
visualization of all the data being emitted. To install it on your cluster, run:
Now, the above configuration can be applied using the `--addon-config` file
with CLI or through `values.yaml` with Helm.

```bash
kubectl apply -f https://run.linkerd.io/tracing/backend.yml
linkerd upgrade --addon-config config.yaml | kubectl apply -f -
```

You will now have a `linker-collector` and `linkerd-jaeger`
deployments in the linkerd namespace that are running as part of the mesh.
Collector has been configured to:

- Receive spans from OpenCensus clients
- Export spans to a Jaeger backend

The collector is extremely configurable and can use the
[receiver](https://opencensus.io/service/receivers/) or
[exporter](https://opencensus.io/service/exporters/) of your choice.

Jaeger itself is made up of many
[components](https://www.jaegertracing.io/docs/1.14/architecture/#components).
The all-in-one image bundles all these components into a single container to
Expand All @@ -82,7 +91,8 @@ Before moving onto the next step, make sure everything is up and running with
`kubectl`:

```bash
kubectl -n tracing rollout status deploy/jaeger
kubectl -n linkerd rollout status deploy/linkerd-collector
kubectl -n linkerd rollout status deploy/linkerd-jaeger
```

## Install Emojivoto
Expand All @@ -104,7 +114,8 @@ spec:
metadata:
annotations:
linkerd.io/inject: enabled
config.linkerd.io/trace-collector: oc-collector.tracing:55678
config.linkerd.io/trace-collector: linkerd-collector.linkerd:55678
config.alpha.linkerd.io/trace-collector-service-account: linkerd-collector
'
```

Expand Down Expand Up @@ -135,7 +146,7 @@ client, but others can be used.
To enable tracing in emojivoto, run:

```bash
kubectl -n emojivoto set env --all deploy OC_AGENT_HOST=oc-collector.tracing:55678
kubectl -n emojivoto set env --all deploy OC_AGENT_HOST=linkerd-collector.linkerd:55678
```

This command will add an environment variable that enables the applications to
Expand All @@ -148,7 +159,7 @@ up in Jaeger. To get to the UI, start a port forward and send your browser to
[http://localhost:16686](http://localhost:16686/).

```bash
kubectl -n tracing port-forward svc/jaeger 16686
kubectl -n linkerd port-forward svc/linkerd-jaeger 16686
```

{{< fig src="/images/tracing/jaeger-empty.png"
Expand All @@ -173,6 +184,13 @@ goes between two meshed pods, there will be a total of 4 spans. Two will be on
the source side as the request traverses that proxy and two will be on the
destination side as the request is received by the remote proxy.

Additionally, As the proxy adds application meta-data as trace attributes, Users
can directly jump into related resources traces directly from the linkerd-web
dashboard by clicking the Jaeger icon in the Metrics Table, as shown below

{{< fig src="/images/tracing/linkerd-jaeger-ui.png"
title="Linkerd-Jaeger" >}}

## Cleanup

To cleanup, remove the tracing components along with emojivoto by running:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 75a02c4

Please sign in to comment.