jaeger 链路追踪部署
- 第一步需要先安装 cert-manager
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.6.3/cert-manager.yaml
- 安装 jaeger Operator On Kubernetes
kubectl create namespace observability
kubectl create -f https://github.com/jaegertracing/jaeger-operator/releases/download/v1.62.0/jaeger-operator.yaml -n observability
- 部署 jaeger 前,需要先创建访问 es 的 key
kubectl create secret generic jaeger-secret --from-literal=ES_PASSWORD=gG45x5lzT2eR8IE44571FltV --from-literal=ES_USERNAME=elastic
- 部署 jaeger
apiVersion: jaegertracing.io/v1
kind: Jaeger
metadata:
name: jaeger-prod
spec:
strategy: production
storage:
type: elasticsearch # jaeger 对接的后端存储
options:
es:
server-urls: https://elasticsearch-es-http.default.svc:9200 # 对应之前 elasticsearch operator 部署的 es 服务
index-prefix: my-prefix
tls:
ca: /es/certificates/ca.crt
secretName: jaeger-secret # 第三步骤创建的 secret
volumeMounts:
- name: certificates
mountPath: /es/certificates/
readOnly: true
volumes:
- name: certificates
secret:
secretName: elasticsearch-es-http-certs-public # 这个对应之前 elasticsearch operator 部署的 es 的 secret
- 如果安装成功,则会如下所示
[root@VM-0-15-opencloudos jaeger]# kubectl get pod,svc
NAME READY STATUS RESTARTS AGE
pod/jaeger-prod-collector-5d77fdf546-vh4lc 1/1 Running 0 143m
pod/jaeger-prod-query-5c4c9769bc-s4drt 2/2 Running 0 143m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/jaeger-prod-collector ClusterIP 192.168.2.132 <none> 9411/TCP,14250/TCP,14267/TCP,14268/TCP,14269/TCP,4317/TCP,4318/TCP 149m
service/jaeger-prod-collector-headless ClusterIP None <none> 9411/TCP,14250/TCP,14267/TCP,14268/TCP,14269/TCP,4317/TCP,4318/TCP 149m
service/jaeger-prod-query NodePort 192.168.2.70 <none> 16686:31915/TCP,16685:30148/TCP,16687:32182/TCP 149m
- 配置 agent,opentelemetry 访问 jaeger 地址
jaeger-prod-collector.default.svc:4318
,其中collector
是收集器,query
是查询与UI,4318
是http
访问,4317
是rpc
访问