Introduction
Jaeger is an open-source end-to-end distributed tracing tool originally developed by Uber Technologies. It is used for monitoring and troubleshooting microservices-based distributed systems.
This guide provides a clear overview of how to install and use Jaeger in Kubernetes with practical examples.
Why Use Jaeger?
- Visualize service dependencies and latencies
- Troubleshoot performance bottlenecks
- Monitor request paths across microservices
- Support for OpenTelemetry
Prerequisites
- A running Kubernetes cluster (e.g., Minikube, k3s, GKE, etc.)
kubectl
configured- Helm installed
1. Install Jaeger with Helm
helm repo add jaegertracing https://jaegertracing.github.io/helm-charts
helm repo update
helm install jaeger jaegertracing/jaeger --set query.basePath=/jaeger --set ingress.enabled=true --set ingress.hosts="{jaeger.yourdomain.com}"
To expose Jaeger locally:
kubectl port-forward svc/jaeger-query 16686:16686
Visit http://localhost:16686
to access the UI.
2. Instrument Your Application
Install the OpenTelemetry SDK for your language. For example, in Python:
pip install opentelemetry-api opentelemetry-sdk opentelemetry-exporter-jaeger
Basic configuration example:
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.jaeger.thrift import JaegerExporter
trace.set_tracer_provider(TracerProvider())
tracer = trace.get_tracer(__name__)
jaeger_exporter = JaegerExporter(
agent_host_name='localhost',
agent_port=6831,
)
trace.get_tracer_provider().add_span_processor(
BatchSpanProcessor(jaeger_exporter)
)
3. Trace Sample Application
Use the tracer to monitor operations:
with tracer.start_as_current_span("example-operation"):
# your business logic
pass
4. View Traces
In the Jaeger UI, you can filter by service, operation, or tags. Use it to find slow or failing requests and analyze dependencies.
Pros and Cons
✅ Pros
- Easy Helm deployment
- Native OpenTelemetry support
- Comprehensive UI and filtering
- Scales with microservices
❌ Cons
- Storage overhead if not configured with retention
- Requires instrumentation in your app
Conclusion
Jaeger is a powerful tool for observability in microservices architecture. With Kubernetes and Helm, it becomes even easier to deploy and scale. Pair it with OpenTelemetry for maximum flexibility.