pushgateway on k8s 部署yaml

12次阅读

共计 1658 个字符,预计需要花费 5 分钟才能阅读完成。

pushgateway on k8s 部署 yaml

prometheus pushgateway 部署的 yaml 文件

pushgateway 的 deployment 文件内容
apiVersion: apps/v1beta2
kind: Deployment
metadata:
namespace: kube-ops
name: pushgateway-ttt
labels:
app: pushgateway-ttt
annotations:
prometheus.io/scrape: “true”
prometheus.io/port: “8080”
spec:
replicas: 1
revisionHistoryLimit: 0
selector:
matchLabels:
app: pushgateway-ttt
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: “25%”
maxUnavailable: “25%”
template:
metadata:
name: pushgateway-ttt
labels:
app: pushgateway-ttt
spec:
containers:
– name: pushgateway-ttt
image: prom/pushgateway:v0.7.0
imagePullPolicy: IfNotPresent
livenessProbe:
initialDelaySeconds: 600
periodSeconds: 10
successThreshold: 1
failureThreshold: 10
httpGet:
path: /
port: 9091
ports:
– name: “app-port”
containerPort: 9091
resources:
limits:
memory: “1000Mi”
cpu: 1
requests:
memory: “1000Mi”
cpu: 1
prom/pushgateway 可以在 hub.docker.io 查到 dockerfile 文件及部署说明

pushgateway 的 service 文件内容
apiVersion: v1
kind: Service
metadata:
name: pushgateway-ttt
namespace: kube-ops
labels:
app: pushgateway-ttt
spec:
selector:
app: pushgateway-ttt
#type: NodePort
ports:
– name: pushgateway-ttt
port: 9091
targetPort: 9091

pushgateway 的 ingress 文件内容
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: pushgateway-ingress
namespace: kube-ops
annotations:
kubernetes.io/ingress.class: nginx
spec:
rules:
– host: push-prometheus.ttt.mucang.cn
http:
paths:
– path: /
backend:
serviceName: pushgateway-ttt
servicePort: 9091
在 Prometheus 中配置 pushgateway 及 pull pushgateway 数据配置
# prometheus 配置文件中配置 pull pushgateway 组件配置
– job_name: ‘pushgateway’
scrape_interval: 60s
metrics_path: /metrics
static_configs:
– targets: [“push-prometheus.xxx.xx.xx]
# prometheus 的 deployment 配置文件配置环境变量,这样 prometheus 才会去 pull pushgateway 缓存的数据
env:
– name: PUSH_GATEWAY
value: “http://push-prometheus.ttt.mucang.cn”

正文完
 0