Kubernetes Guides

Kubernetes Tutorial : Distributed tracing with Jaeger

Jaeger is an open-source distributed tracing system by Uber Technologies. Like Dapper or Zipkin, it is used for monitoring and troubleshooting microservices-based distributed systems. In this post, we are going to look at how to deploy Jaeger to the Kubernetes cluster.

This quickstart assumes a basic understanding of Kubernetes concepts, please refer to earlier posts for understanding on Kubernetes & how to create, deploy & rollout updates to the cluster.

Image – Jaeger Distributed Tracing

#1.Why Distributed Tracing?

In the Microservices architecture, the application is usually structured as a set of loosely coupled, collaborating services. Each service implements a set of related functions. For example, an application might consist of services such as the order management service, the customer management service, etc. Services communicate using either synchronous protocols such as HTTP/REST or asynchronous protocols such as AMQP. Services can be developed and deployed independently of one another. Each service has its own database in order to be decoupled from other services. For more intro on Microservice architecture, check out here.

Service requests often span multiple services. Each service handles a request by performing one or more operations, e.g. database queries, publishes messages, etc. To understand the behavior of an application and troubleshoot problems there is a need to monitor each service but if you use any of the external monitoring tools, it only tells you the overall response time and number of invocations but there would be no insight into the individual operations. To understand how each service is performing we would need to instrument services with code that will do the following

  1. Assign each external request a unique external request id
  2. Pass the external request id to all services that are involved in handling the request
  3. Include the external request id in all log messages
  4. Record information (e.g. start time, end time) about the requests and operations performed when handling an external request in a centralized service

So this where Jaeger can help us, it supports the OpenTracing initiative and can be used for monitoring microservices-based distributed systems:

  • Distributed context propagation
  • Distributed transaction monitoring
  • Root cause analysis
  • Service dependency analysis
  • Performance / latency optimization

#2.Key Features of Jaeger

  • High Scalability – Jaeger backend is designed to have no single point of failure and to scale with the business needs.
  • Native support for OpenTracing – Jaeger backend, Web UI, and instrumentation libraries have been designed from the ground up to support the OpenTracing standard.
  • Storage Backend – Jaeger supports two popular open-source NoSQL databases as trace storage backends: Cassandra 3.4+ and Elasticsearch 5.x/6.x.
  • Modern UI – Jaeger Web UI is implemented in Javascript using popular open-source frameworks like React.
  • Cloud-Native Deployment – Jaeger backend is distributed as a collection of Docker images. Deployment to Kubernetes clusters is assisted by Kubernetes templates and a Helm chart.
  • All Jaeger backend components expose Prometheus metrics by default.

#3.Jaeger Architecture

Image – Jaeger Tracing Architecture

Following are the Key components of Jaeger

  • Jaeger clients: These are language-specific implementations of the OpenTracing API. They can be used to instrument applications for distributed tracing either manually or with open source frameworks. Jaeger’s clients adhere to the data model described in the OpenTracing standard.
  • Jaeger agent: Network daemon that listens for spans sent over UDP, which it batches and sends to the collector.
  • Jaeger collector: Receives traces from Jaeger agents and runs them through a processing pipeline.
  • Query: Service that retrieves traces from storage and hosts a UI to display them.

An instrumented service creates spans when receiving new requests and attaches context information (trace id, span id, and baggage) to outgoing requests. This instrumentation has very little overhead and is designed to be always enabled in production.

Span represents a logical unit of work in Jaeger that has an operation name, the start time of the operation, and the duration. Spans may be nested and ordered to model causal relationships. Trace is a data/execution path through the system and can be thought of as a directed acyclic graph of spans.

Image – Distributed Tracing -Trace & Spans

In the next section, we will learn how to deploy Jaeger on the Kubernetes cluster.

#4.Deploy Jaeger Template on Kubernetes Cluster

Assuming you already have the Kubernetes cluster ready, Deploying Jaeger is just a simple 1-step procedure. If you want to set up the Kubernetes cluster and get a basic understanding of Kubernetes concepts, please refer to earlier posts for understanding on Kubernetes & how to create, deploy & rollout updates to the cluster.

Execute kubectl create deployment on your cluster. What I have is just a sample template and not to be used in a production environment.

kubectl create -f https://raw.githubusercontent.com/jaegertracing/jaeger-kubernetes/master/all-in-one/jaeger-all-in-one-template.yml

Image – Jaeger Template deployment

Post Kubectl create command, you can use Kubectl get command to see the deployments.

Image – Kubectl get deployments command

Use kubectl get service jaeger-query to find Jaeger URL.

Image – Get Jaeger URL

To understand what we have accomplished, the Jaeger template has instrumented services with code that will do the following

  1. Assign each external request a unique external request id
  2. Pass the external request id to all services that are involved in handling the request
  3. Include the external request id in all log messages
  4. Record information (e.g. start time, end time) about the requests and operations performed when handling an external request in a centralized service

Congrats! today we have learned what is Jaeger tracing & how to do deploy it to the Kubernetes cluster.

If you’re looking to run along with Helm, check out, here.

#5.Sample Traces View

Image – Jaeger Traces
Image – Traces Detail View

Like this post? Don’t forget to share it!

Useful Resources :

Summary
Article Name
Kubernetes Tutorial : Distributed tracing with Jaeger
Description
Jaeger is a distributed tracing system. Like Dapper or Zipkin,it is used for monitoring and troubleshooting microservices-based distributed systems. In this post, we are going look at how to deploy Jaeger on to Kubernetes cluster.
Author
Publisher Name
Upnxtblog
Publisher Logo
Karthik

Allo! My name is Karthik,experienced IT professional.Upnxtblog covers key technology trends that impacts technology industry.This includes Cloud computing,Blockchain,Machine learning & AI,Best mobile apps, Best tools/open source libs etc.,I hope you would love it and you can be sure that each post is fantastic and will be worth your time.

Share
Published by
Karthik

Recent Posts

Finding the Right Time to Build Your Software Instead of Buy

There are few things as valuable to a business as well-designed software. Organizations today rely…

6 days ago

Innovators in Crypto: Prominent AI-Powered Coins

The cryptocurrency industry is being reshaped by the fusion of blockchain technology and artificial intelligence…

3 weeks ago

Top AI Design Tools Every Graphic Designer Should Use in 2024

Introduction Artificial Intelligence (AI) has also found its relevance in graphic design and is quickly…

2 months ago

Transforming Industries: The Integration of AI and Blockchain

Imagine a world where the brilliance of Artificial Intelligence (AI) meets the unbreakable security of…

2 months ago

How Can I Use Automation to Streamline My Digital Marketing Efforts?

In today’s fast-paced digital landscape, automation is not just a luxury but a necessity for…

2 months ago

Top 5 AI Technologies Transforming the Casino Gaming Landscape in 2025

The world of casino gaming has leveraged the emerging technology advancements to create immersive and…

3 months ago

This website uses cookies.