如何部署Tempo取决于我们的tracing需求。Tempo有两种部署模式:单体式或微服务式。当使用Helm在Kubernetes集群上部署Tempo时,对这两种模式都支持。

使用Tempo的Helm Charts可以在Kubernetes集群中配置、安装和升级Tempo。

Tempo的仓库中有一个示例Helm Chart,展示了一个完整的基于微服务的部署。

Tempo有两个主要的Helm Chart用于部署:

  • tempo-distributed以微服务模式部署Tempo
  • tempo以单体模式(单一二进制文件)部署Tempo

这里将使用tempo-distributed来演示Tempo的部署。将按照以下步骤进行:

  1. 在Kubernetes集群中创建自定义命名空间
  2. 下载Helm Chart
  3. 定制Helm Chart的values.yaml配置,并配置使用外部的MinIO S3存储
  4. 使用Helm安装Tempo

1.在Kubernetes集群中创建自定义命名空间

使用自定义命名空间可以在后续遇到问题时方便清理工作:

1kubectl create namespace tempo-test

2.下载Helm Chart

下载tempo-distributed这个helm chart,这里下载的是1.4.2版本:

1wget https://github.com/grafana/helm-charts/releases/download/tempo-distributed-1.4.2/tempo-distributed-1.4.2.tgz

3.定制Helm Chart值

创建一个values.yaml文件:

 1---
 2storage:
 3  trace:
 4    backend: s3
 5    s3:
 6      access_key: 'grafana-tempo'
 7      secret_key: 'supersecret'
 8      bucket: 'tempo-traces'
 9      endpoint: 'tempo-minio:9000'
10      insecure: true
11minio:
12  enabled: false
13
14traces:
15  otlp:
16    grpc:
17      enabled: true
18    http:
19      enabled: true
20  zipkin:
21    enabled: false
22  jaeger:
23    thriftHttp:
24      enabled: false
25  opencensus:
26    enabled: false

4.使用Helm安装Tempo

1helm -n tempo-test install tempo ./tempo-distributed-1.4.2.tgz -f values.yaml

使用以上定制的values.yaml安装tempo后,启动了以下Pod:

 1k get po -n tempo-test
 2NAME                                    READY   STATUS    RESTARTS   AGE
 3tempo-compactor-79d94c55c6-ncfjl        1/1     Running   0          4m11s
 4tempo-distributor-c4c797d9f-4jx5k       1/1     Running   0          4m11s
 5tempo-gateway-78f4b54d56-jl5bz          1/1     Running   0          4m11s
 6tempo-ingester-0                        1/1     Running   0          4m11s
 7tempo-ingester-1                        1/1     Running   0          4m11s
 8tempo-ingester-2                        1/1     Running   0          4m11s
 9tempo-querier-5569795f85-8nvgv          1/1     Running   0          4m11s
10tempo-query-frontend-5885b78c84-4cfr6   1/1     Running   0          4m11s

tempo-gatewy的Ingress可以将query-frontend暴露到K8S集群外部。下面从K8S集群外部通过访问tempo的API验证一下:

1curl -u user:pwd https://tempo-gateway.example.com/api/echo
2echo

参考