pushgateway on k8s是怎樣部署yaml,很多新手對(duì)此不是很清楚,為了幫助大家解決這個(gè)難題,下面小編將為大家詳細(xì)講解,有這方面需求的人可以來(lái)學(xué)習(xí)下,希望你能有所收獲。
成都創(chuàng)新互聯(lián)堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站制作、網(wǎng)站設(shè)計(jì)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的射陽(yáng)網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!
pushgateway on k8s
部署yaml
prometheus pushgateway
部署的yaml
文件pushgateway
的deployment
文件內(nèi)容
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
文件及部署說(shuō)明,啟動(dòng)參數(shù)--persistence.file
等都是放入spec.args
中添加即可生效;
所有啟動(dòng)參數(shù):
--web.listen-address default:9091 --web.telemetry-path default:/metrics --web.route-prefix default:"" --persistence.file default: "" --persistence.interval default: 5m
參數(shù)說(shuō)明地址
pushgateway
的service
文件內(nèi)容
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
文件內(nèi)容
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
數(shù)據(jù)配置# prometheus配置文件中配置pull pushgateway組件配置 - job_name: 'pushgateway' scrape_interval: 60s metrics_path: /metrics static_configs: - targets: ["push-prometheus.xxx.xx.xx] # prometheus的deployment配置文件配置環(huán)境變量,這樣prometheus才會(huì)去pull pushgateway緩存的數(shù)據(jù) # 所有推到pushgateway的數(shù)據(jù)都會(huì)在/metrics接口的體現(xiàn)
看完上述內(nèi)容是否對(duì)您有幫助呢?如果還想對(duì)相關(guān)知識(shí)有進(jìn)一步的了解或閱讀更多相關(guān)文章,請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝您對(duì)創(chuàng)新互聯(lián)的支持。