1 Star 0 Fork 4

Shiro/thanos-install

forked from cuiliang/thanos-install 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
prometheus.yaml 4.94 KB
一键复制 编辑 原始数据 按行查看 历史
cuiliang 提交于 2023-02-20 16:23 . 更新组件版本
apiVersion: v1
kind: Service
metadata:
name: prometheus-headless
namespace: thanos
labels:
app: prometheus
spec:
type: ClusterIP
clusterIP: None
selector:
app: prometheus
ports:
- name: web
port: 9090
targetPort: web
- name: grpc
port: 10901
targetPort: grpc
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: prometheus
namespace: thanos
labels:
app: prometheus
spec:
serviceName: prometheus-headless
podManagementPolicy: Parallel
replicas: 2
selector:
matchLabels:
app: prometheus
template:
metadata:
labels:
app: prometheus
spec:
serviceAccountName: prometheus
securityContext:
runAsUser: 0
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- prometheus
topologyKey: kubernetes.io/hostname
containers:
- name: prometheus
image: harbor.com/prometheus/prometheus:v2.42.0
imagePullPolicy: IfNotPresent
resources:
limits:
memory: "32Gi"
cpu: "8"
requests:
memory: "128Mi"
cpu: "100m"
args:
- --config.file=/etc/prometheus/config_out/prometheus.yaml
- --storage.tsdb.path=/prometheus
- --storage.tsdb.retention.time=4h # tsdb本地数据存放天数
- --storage.tsdb.no-lockfile # 允许重叠的块,从而启用垂直压缩和垂直查询合并
- --storage.tsdb.min-block-duration=2h #每2h生成一个 TSDB 数据块
- --storage.tsdb.max-block-duration=2h
- --web.route-prefix=/ # URL路径前缀
- --web.enable-admin-api # 通过一些命令去管理数据
- --web.enable-lifecycle # 支持热更新 localhost:9090/-/reload 加载
- --log.level=debug
ports:
- containerPort: 9090
name: web
protocol: TCP
livenessProbe:
failureThreshold: 6
httpGet:
path: /-/healthy
port: web
scheme: HTTP
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 3
readinessProbe:
failureThreshold: 120
httpGet:
path: /-/ready
port: web
scheme: HTTP
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 3
volumeMounts:
- name: prometheus-config-out
mountPath: /etc/prometheus/config_out
- name: prometheus-rule
mountPath: /etc/prometheus/rules
- name: etcd-ssl
mountPath: /var/run/secrets/etcd
- name: thanos-data
mountPath: /prometheus
- name: sidecar
image: harbor.com/prometheus/thanos:v0.30.2
imagePullPolicy: IfNotPresent
resources:
limits:
memory: "8Gi"
cpu: "4"
requests:
memory: "128Mi"
cpu: "100m"
args:
- sidecar
- --log.level=debug
- --tsdb.path=/prometheus
- --prometheus.url=http://127.0.0.1:9090
- --objstore.config-file=/etc/thanos/storage.yaml
- --reloader.config-file=/etc/prometheus/config/prometheus.yaml.tmpl
- --reloader.config-envsubst-file=/etc/prometheus/config_out/prometheus.yaml
- --reloader.rule-dir=/etc/prometheus/rules/
ports:
- name: http-sidecar
containerPort: 10902
- name: grpc
containerPort: 10901
livenessProbe:
httpGet:
port: http-sidecar
path: /-/healthy
readinessProbe:
httpGet:
port: http-sidecar
path: /-/ready
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: CLUSTER
value: "shanghai-prod"
volumeMounts:
- name: prometheus-config
mountPath: /etc/prometheus/config
- name: prometheus-config-out
mountPath: /etc/prometheus/config_out
- name: thanos-data
mountPath: /prometheus
- name: prometheus-rule
mountPath: /etc/prometheus/rules
- name: thanos-storage-config
subPath: storage.yaml
mountPath: /etc/thanos/storage.yaml
volumes:
- name: prometheus-config
configMap:
name: prometheus-config
- name: prometheus-config-out
emptyDir: {}
- name: thanos-data
emptyDir: {}
- name: prometheus-rule
configMap:
name: prometheus-rule
- name: etcd-ssl
secret:
secretName: etcd-ssl
items:
- key: tls.key
path: tls.key
- key: tls.crt
path: tls.crt
- name: thanos-storage-config
secret:
secretName: thanos-objectstorage
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/shunzi115/thanos-install.git
[email protected]:shunzi115/thanos-install.git
shunzi115
thanos-install
thanos-install
master

搜索帮助