How to Deploy jager to Kubernetes

How to Deploy jager to Kubernetes

Overview

When running services in a kubernetes cluster, it will be desirable to run tracing to see how the system works as a whole, and trace the flows between the microservices.

Install jaeger

We will deploy the jaeger operator.

helm repo add jaegertracing https://jaegertracing.github.io/helm-charts
helm repo update

Before we can install the operator, we will need to install cert manager

kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.10.1/cert-manager.yaml

Now, we can install jaeger

helm install jaeger-op --set rbac.clusterRole=true jaegertracing/jaeger-operator

To get this up and running, we will deploy a minimal install. We can make this more complicated in the future, but let’s get something working. This is the all-in-one configuration

jaeger.yaml

---
apiVersion: jaegertracing.io/v1
kind: Jaeger
metadata:
  name: jaeger

Reconfigure Traefik

Now that we have jaeger up and running, we need to reconfigure traefik to connect to it. First, we will modify the helm values file

traefik-values.yaml

tracing:
  jaeger:
    samplingServerURL: http://jaeger-agent.default.svc:5778/sampling
    localAgentHostPort: jaeger-agent.default.svc:6831

We will now upgrade the helm chart

helm upgrade traefik traefik/traefik --values traefik-values.yaml

Configure jaeger

We will now need to add an ingress into jaeger so that we can view the web console

jaeger-ingress.yaml

---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
  name: jaeger-ingress
  namespace: default
spec:
  entryPoints:
    - web
    - websecure
  routes:
    - match: Host(`jaeger.weepynet.com`)
      kind: Rule
      services:
        - name: jaeger-query
          port: 16686
      middlewares:
        - name: redirect-https

We will add this ingress

kubectl apply -f jaeger-ingress.yaml