Prometheus+Grafana 监控 K8S Ingress-Ningx Controller
ingress-nginx默认是没有开启监控指标的,必要我们在ingress-nginx controller的svc内里开启10254端口来暴露监控指标 然后进行抓取https://i-blog.csdnimg.cn/direct/ab7033fc8c7d40c68b0237a1a4ffc29e.png
ps:kubeadm方式和二进制方式部署的k8s集群都可以用此设置监控Ingress-Ningx Controller
一、prometheus中添加ingress-nginx的服务发现设置
prometheus部署链接:https://blog.csdn.net/qq_44930876/article/details/138163947
- job_name: 'kubernetes-ingress-controller'
kubernetes_sd_configs:
- role: endpoints
relabel_configs:
- action: keep
regex: ingress-nginx;ingress-nginx-controller;metrics
source_labels:
- __meta_kubernetes_namespace
- __meta_kubernetes_service_name
- __meta_kubernetes_endpoint_port_name
scheme: http
二、ingress-nginx controller的service添加端口暴露监控指标
apiVersion: v1
kind: Service
...
spec:
ports:
- appProtocol: http
name: http
port: 80
protocol: TCP
targetPort: http
- appProtocol: https
name: https
port: 443
protocol: TCP
targetPort: https
- name: metrics
port: 10254
targetPort: 10254
...
https://i-blog.csdnimg.cn/direct/4f4c48d10f7449c7be031bc47c40d2b5.png
然后重新apply一下使其ingress-controller见效
https://i-blog.csdnimg.cn/direct/656261dd0bc5476fb1e44162c0e61bce.png
完成开启10254端口后就可以在prometheus上看到监控的ingress-nginx目的了
https://i-blog.csdnimg.cn/direct/fbda2ee62ca845d19b2e97ed23b02f22.png
三、grafana添加ingress-nginx controller的监控模版
grafana模版中心ingress-nginx监控模版:https://grafana.com/grafana/dashboards/20275-ingress-nginx-dashboard/
大概直接使用我下载好的:
https://download.csdn.net/download/qq_44930876/89871863
大概直接导入 grafana模版中心的ingress-nginx controller监控模板ID:20275
https://i-blog.csdnimg.cn/direct/f092e878871e4857ac7f143d2c7f70fe.png
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页:
[1]