本文主要是介绍telegraf监控k8s服务健康状态,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
部署influxdb
// todo
部署telegraf
spep1: 拉telegraf:1.12.2+的镜像
docker pull telegraf:1.12.2
step2: 准备telegraf的configMap
注意替换你的influxdb地址
step3: 准备telegraf的ds yaml
step4: 准备rabc授权的yaml
k8s版本要1.9+才支持aggregationRule
注意替换对应的servicename账户和namespace
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:name: influx:cluster:viewerlabels:rbac.authorization.k8s.io/aggregate-view-telegraf: "true"
rules:- apiGroups: [""]resources: ["persistentvolumes", "nodes"]verbs: ["get", "list"]---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:name: influx:telegraf
aggregationRule:clusterRoleSelectors:- matchLabels:rbac.authorization.k8s.io/aggregate-view-telegraf: "true"- matchLabels:rbac.authorization.k8s.io/aggregate-to-view: "true"
rules: [] # Rules are automatically filled in by the controller manager.---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:name: influx:telegraf:viewer
roleRef:apiGroup: rbac.authorization.k8s.iokind: ClusterRolename: influx:telegraf
subjects:- kind: ServiceAccountname: telegraf // 你的sa账户namespace: default / 你的ns
这篇关于telegraf监控k8s服务健康状态的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!