欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 健康 > 美食 > Kubernetes Promethues监控集群外服务(Mysql示例)

Kubernetes Promethues监控集群外服务(Mysql示例)

2024/11/30 18:12:34 来源:https://blog.csdn.net/joker_zhou/article/details/144130940  浏览:    关键词:Kubernetes Promethues监控集群外服务(Mysql示例)

安装mysqld_export

找一台服务器安装即可,按照 https://github.com/prometheus/mysqld_exporter 文档安装即可

Kubernetes配置

配置End-Pointer

apiVersion: v1
kind: Endpoints
metadata:labels:app: mysqld-exporter-metricsname: mysqld-exporter-metricsnamespace: monitoringresourceVersion: "37417798"uid: 629a0ed2-9200-4129-97ed-a77014141714
subsets:
- addresses:- ip: #Mysqld_Exporter地址ports:- name: metricsport: 9104 #指标暴露的端口protocol: TCP

配置Service

apiVersion: v1
kind: Service
metadata:labels:app: mysqld-exporter-metricsname: mysqld-exporter-metricsnamespace: monitoring
spec:internalTrafficPolicy: ClusteripFamilies:- IPv4ipFamilyPolicy: SingleStackports:- name: metricsport: 9913protocol: TCPtargetPort: 9913sessionAffinity: Nonetype: ClusterIP

配置ServiceMonitor即可

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:generation: 1labels:app: mysqld-exporter-metricsname: mysqld-exporter-metricsnamespace: monitoring
spec:endpoints:- honorLabels: trueinterval: 10spath: /metricsport: metricsscheme: httpscrapeTimeout: 10snamespaceSelector:matchNames:- monitoringsampleLimit: 0selector:matchLabels:app: external-nginx

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com