Stop Overthinking It: A 5 Minute Guide for Experimenting with Ambassador Easily in a Kubernetes Sandbox

Alex Gervais
JaegerTracing
Published in
5 min readNov 12, 2020

Implementing distributed tracing is fast becoming a fundamental expectation when building modern (distributed) systems. However, this is yet another thing for developers to learn, and configuring distributed tracing on Kubernetes is hard, right? Actually, no. Getting started with Jaeger on Kubernetes has never been easier. Using the K8s Initializer, you can create a sandbox environment for your Kubernetes installation with a pre-configured Ambassador Edge Stack ingress controller, a Jaeger deployment for storing and visualizing distributed traces, and an OpenTelemetry Collector for granular control over observability. You can even install ArgoCD for deploying your own apps.

Taking 5 minutes to install a playground is a great way to validate your instrumentation, trial integrations and understand observability patterns without committing to production decisions just yet.

Install Your Sandbox

Creating a Kubernetes sandbox environment with a configured runtime application stack is exactly what the K8s Initializer was designed for. Because every production setup is different, and because the number of configurations options, flags and permutations are virtually infinite, the K8s Initializer takes a different and simpler approach to configuration: generate bootstrap Kubernetes resources for everyone with sane defaults by asking a few well-targeted questions. The generated bundles of YAML are perfect to trial technologies before their adoption and ideal to create rapid experimental demo-friendly environments.

K8s Initializer observability options and Jaeger enabled
K8s Initializer observability options and Jaeger enabled

Wherever you might be deploying your sandbox to, the K8s Initializer will first guide you through the setup required to install the ingress controller in your target environment. The next (and final!) configuration step requires enabling Jaeger for collecting distributed traces by toggling the checkbox “ON”.

Navigating to the installation instructions by clicking the “Review and Install” button, will bring us over to the easy 3-step install process:

  • First, apply the Kubernetes Custom Resource Definitions (CRDs) that are necessary for Ambassador and the Jaeger Operator to function.
  • Second, create the actual Kubernetes resources, such as the Deployments, Services and various custom resources. Here, all the necessary Kubernetes pods get started.
  • Third, configure the running target environment with post-installation actions, such as TLS.

If you prefer to have a look at the Kubernetes manifests before applying them to a target environment, you may inspect them directly in the K8s Initializer or download them in a zip bundle.

With the installation complete, we are ready to go! Let’s open up a new browser window to the URL specified for the Jaeger UI, typically https://$AMBASSADOR_SERVICE_IP/jaeger/, and drill down into our playground environment architecture.

Collect Traces and Spans from the Edge to Services

The Ambassador Edge Stack, sitting at the very edge of our Kubernetes network, is acting as our ingress controller. Being the entrypoint and router from the public internet into our private microservices network, Ambassador will make sure to:

  • Tag each incoming request with a unique identifier;
  • Initiate the root trace and root span;
  • Send the root trace and span to the OpenTelemetry Collector using the Zipkin API;
  • Propagate the context to downstream services using X-B3 format header propagation;

There’s already a lot to digest here! Ambassador, in a similar fashion to any custom business application you would deploy, is one of the hops an inbound request has to go through. Ambassador will make sure to record this hop and transmit the associated trace to the collector. The receiver of the trace data is the OpenTelemetry Collector.

The OpenTelemetry Collector is a powerful component that supports multiple receiving APIs and protocols such as Zipkin, Jaeger Thrift, Jaeger gRPC, OpenTelemetry Protocol (OTLP) and many more. The OpenTelemetry Collector can then discard unwanted traces, enrich the trace data with more contextual information, and most importantly aggregate the traces from multiple APIs. This allows our Ambassador installation to report traces in the Zipkin format, and your custom application code to instrument and report traces using the Jaeger libraries for example. We get full interoperability between different distributed tracing standards.

Once received and processed by the OpenTelemetry Collector, the distributed tracing data will get exported to the running Jaeger deployment.

Store the Trace Data in Jaeger

The OpenTelemetry Collector is a simple buffer and aggregator, and will not persist any trace data. To store and persist our collection of traces, we’ll export the data from the OpenTelemetry Collector to a Jaeger deployment running in the same Kubernetes cluster and managed by the Jaeger Operator.

Here, as we are looking for a way to quickly get up and running, the K8s Initializer chooses an all-in-one Jaeger deployment consisting of a collector, a UI and in-memory storage. This option reduces the footprint of the installation, making it suitable for local development sandboxes. When adopting Jaeger in production, a different storage technology should be considered such as Cassandra or Elasticsearch.

Visualize Distributed Traces with Jaeger

If you’ve been reading carefully, you probably noticed we already have all the pieces of the puzzle here:

  • We have a running all-in-one Jaeger deployment that stores our tracing data and provides a web UI with a search engine.
  • We have an Ambassador Edge Stack ingress controller that exposes services running inside Kubernetes to the outside world.

All we are missing are a few configuration flags and a Mapping resource to route internet traffic to our Jaeger installation. Hopefully, this was all already configured, installed and taken care of by the K8s Initializer! The Jaeger UI is available at https://$AMBASSADOR_SERVICE_IP/jaeger/.

Navigating to the UI, you’ll notice that Jaeger already started storing trace data emitted from our Ambassador ingress controller. Let’s query and visualize a few traces:

Ambassador traces visible in the Jaeger UI
Ambassador traces visible in the Jaeger UI

Start Experimenting Today!

The K8s Initializer enabled us to configure, install and play around with a Jaeger sandbox on Kubernetes to showcase how easy, yet powerful, trace collection and visualization can be in a distributed system.

Now it’s up to you to bootstrap your own environment and experiment. One might look at different code instrumentation libraries, look at transforming the playground by introducing Jaeger Agents into the architecture, or integrating more building blocks into the sandbox by including Prometheus for metrics collection or Knative for a Serverless component. Give it a try: https://app.getambassador.io/initializer/

To learn more about Jaeger and Kubernetes playgrounds, we recommend checking out the following resources:

--

--

Alex Gervais
JaegerTracing

Outdoorsy, data-driven, eternal student, not so geeky creative mind and traveler. Distributed Systems Architect & Tech Lead. ex-Ambassador Labs, ex-AppDirect