thanos部署(四)|thanos部署(四) -- store和compactor
本篇thanos部署是基于prometheus-operator,prometheus-operator为thanos提供了在CRD和controller上的支持。
store组件
- 部署store statefulset
store提供了StoreAPI,以便querier查询object storage中的历史数据;
# cat thanos-store-sts.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: thanos-store
namespace: monitoring
labels:
app: thanos-store
spec:
serviceName: "thanos-store"
replicas: 1
selector:
matchLabels:
app: thanos-store
template:
metadata:
labels:
app: thanos-store
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "10902"
spec:
containers:
- name: thanos-store
image: thanosio/thanos:v0.18.0
args:
- "store"
- "--log.level=debug"
- "--data-dir=/var/thanos/store"
- "--objstore.config-file=/config/thanos.yaml"
ports:
- name: http
containerPort: 10902
- name: grpc
containerPort: 10901
- name: cluster
containerPort: 10900
volumeMounts:
- name: config
mountPath: /config/
readOnly: true
- name: data
mountPath: /var/thanos/store
volumes:
- name: data
emptyDir: {}
- name: config
secret:
secretName: thanos-objstore-config
volumes增加了之前创建的secret: thanos-objstore-conf,其配置了访问minio的方法;
- 部署store service
部署svc主要是为querier组件使用,端口类型为clusterIP:
# cat thanos-store-svc.yaml
apiVersion: v1
kind: Service
metadata:
name: thanos-store
namespace: monitoring
spec:
type: ClusterIP
clusterIP: None
ports:
- name: grpc
port: 10901
targetPort: grpc
selector:
app: thanos-store
- 将store service的地址告诉querier组件
修改thanos-querier-deploy.yaml,在querier启动参数,增加store的配置
containers:
- name: thanos
image: thanosio/thanos:v0.18.0
args:
- "query"
- "--log.level=debug"
- "--query.replica-label=prometheus_replica"
- "--store=dnssrv+prometheus-operated:10901"
- "--store=dnssrv+thanos-store:10901"
这里增加了store的svc: --store=dnssrv+thanos-store:10901
- 查看querier UI确认store添加OK
文章图片
- 部署compactor statefulset
# cat thanos-compactor-sts.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: thanos-compactor
namespace: monitoring
labels:
app: thanos-compactor
spec:
serviceName: "thanos-compactor"
replicas: 1
selector:
matchLabels:
app: thanos-compactor
template:
metadata:
labels:
app: thanos-compactor
spec:
containers:
- name: thanos-compactor
image: thanosio/thanos:v0.18.0
args:
- "compact"
- "--log.level=debug"
- "--data-dir=/var/thanos/store"
- "--objstore.config-file=/config/thanos.yaml"
- "--wait"
ports:
- name: http
containerPort: 10902
volumeMounts:
- name: config
mountPath: /config/
readOnly: true
- name: data
mountPath: /var/thanos/store
volumes:
- name: data
emptyDir: {}
- name: config
secret:
secretName: thanos-objstore-config
由于要访问minio,同样配置了secret:thanos-objstore-config,作为volumne挂载;
- 部署compactor svc
# cat thanos-compactor-service.yaml
apiVersion: v1
kind: Service
metadata:
name: thanos-compactor
labels:
app: thanos-compactor
namespace: monitoring
spec:
selector:
app: thanos-compactor
ports:
- port: 10902
name: http
端口类型ClusterIP。
部署完成后,查看monitoring下的所有pod
文章图片
【thanos部署(四)|thanos部署(四) -- store和compactor】参考:
- https://mp.weixin.qq.com/s/E6...
- https://thanos.io/tip/compone...
- https://mp.weixin.qq.com/s?__...
推荐阅读
- 跌跌撞撞奔向你|跌跌撞撞奔向你 第四章(你补英语,我补物理)
- 奔向你的城市
- 四首关于旅行记忆的外文歌曲
- CET4听力微技能一
- 亲子日记第186篇,2018、7、26、星期四、晴
- Beego打包部署到Linux
- 特种兵训练第四天
- 第四十三篇接纳孩子的感受
- 《自我的追寻》读书笔记3
- 不让记忆、感觉、情绪成为孩子的负累|不让记忆、感觉、情绪成为孩子的负累|《全脑教养法》(四)