'Jaeger with spring boot is not working when both are deployed at kubernetes
I am trying to trace logs of my spring-boot-application with jaeger .
Both spring-boot microservice and jaeger are running on kubernetes ( local set-up on docker-desktop ) . My services traces are not visible in jaeger UI .
The same spring boot microservice and Jaeger local set up (without kuberntes ) is working fine .
Below is the configuration in my application.properties to interact with jaeger-agent in kubernetes .
opentracing.jaeger.udp-sender.host=jaeger-agent
opentracing.jaeger.udp-sender.port=6831
Below is my code :
https://github.com/anuragk3334/Spring-boot-and-Jaeger/tree/master/HelloWorld
Jaeger configuration is :
https://github.com/anuragk3334/Spring-boot-and-Jaeger/blob/master/HelloWorld/k8s/jaeger.yaml
$ kubectl describe svc jaeger-agent
Name: jaeger-agent
Namespace: default
Labels: app=jaeger
app.kubernetes.io/component=agent
app.kubernetes.io/name=jaeger
Annotations: Selector: app.kubernetes.io/component=all-in-one,app.kubernetes.io/name=jaeger
Type: ClusterIP
IP: None
Port: agent-zipkin-thrift 5775/UDP
TargetPort: 5775/UDP
Endpoints: 10.1.0.234:5775
Port: agent-compact 6831/UDP
TargetPort: 6831/UDP
Endpoints: 10.1.0.234:6831
Port: agent-binary 6832/UDP
TargetPort: 6832/UDP
Endpoints: 10.1.0.234:6832
Port: agent-configs 5778/TCP
TargetPort: 5778/TCP
Endpoints: 10.1.0.234:5778
Session Affinity: None
Events: <none>
Solution 1:[1]
I've just tried that and tested it with OpenShift environment. But in my case I use a Jaeger Operator in my OpenShift environment.
You have to add an annotation which points to your Jaeger instance. You can refer to this documentation. Check the deployment yaml fragment I've used in my deployment app below;
sidecar.jaegertracing.io/inject: jaeger-volatile-sp-demo
Here you can find where it is defined, in the metadata.annotations;
apiVersion: apps/v1
kind: Deployment
metadata:
name: lev-restapp
labels:
tier: vertrouwd
group: plooi-test
ingress-frontoffice-policy: allow
lev-label: lev-restapp
annotations:
sidecar.jaegertracing.io/inject: jaeger-volatile-sp-demo # Inject Jaeger instance, must have unique name in cluster
spec:
replicas: 1
selector:
matchLabels:
lev-label: lev-restapp
template:
metadata:
...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Levent Divilioglu |