kubernetes K8s的监控系统Prometheus升级Grafana,来一个酷炫的Node监控界面(二)

  上一篇文章《kubernetes K8s的监控系统Prometheus安装使用(一)》中使用的监控界面总感觉监控的节点数据太少,不能快算精准的判断出数据节点运行的状况。

今天我找一款非常酷炫的多维度数据监控界面,能够非常有把握的了解到各节点的数据,以及运行状况。

1升级Grafana

这次我们把Grafana升级到8.4.7版本,这样才能展示出上面那种界面效果。

复制代码
kubectl apply -f grafana8-deploy.yaml
kubectl apply -f grafana8-ing.yaml

这两个yaml文件的内容如下

grafana8-deploy.yaml

yaml 复制代码
apiVersion: apps/v1
kind: Deployment
metadata:
  name: grafana-core
  namespace: kube-system
  labels:
    app: grafana
    component: core
spec:
  replicas: 1
  selector:
    matchLabels:
      app: grafana
      component: core
  template:
    metadata:
      labels:
        app: grafana
        component: core
    spec:
      containers:
      - image: grafana/grafana:4.2.0
        name: grafana-core
        imagePullPolicy: IfNotPresent
        # env:
        resources:
          # keep request = limit to keep this container in guaranteed class
          limits:
            cpu: 100m
            memory: 100Mi
          requests:
            cpu: 100m
            memory: 100Mi
        env:
          # The following env variables set up basic auth twith the default admin user and admin password.
          - name: GF_AUTH_BASIC_ENABLED
            value: "true"
          - name: GF_AUTH_ANONYMOUS_ENABLED
            value: "false"
          # - name: GF_AUTH_ANONYMOUS_ORG_ROLE
          #   value: Admin
          # does not really work, because of template variables in exported dashboards:
          # - name: GF_DASHBOARDS_JSON_ENABLED
          #   value: "true"
        readinessProbe:
          httpGet:
            path: /login
            port: 3000
          # initialDelaySeconds: 30
          # timeoutSeconds: 1
        volumeMounts:
        - name: grafana-persistent-storage
          mountPath: /var
      volumes:
      - name: grafana-persistent-storage
        emptyDir: {}

grafana8-ing.yaml

yaml 复制代码
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
   name: grafana
   namespace: kube-system
   annotations:
     nginx.ingress.kubernetes.io/enable-cors: "true"
     nginx.ingress.kubernetes.io/cors-allow-methods: "GET, POST, OPTIONS"
     nginx.ingress.kubernetes.io/cors-allow-origin: "*"
     nginx.ingress.kubernetes.io/cors-allow-headers: "DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization"
spec:
   rules:
   - host: k8s.grafana
     http:
       paths:
       - path: /
         backend:
          serviceName: grafana
          servicePort: 3000

升级完成后访问Grafana,还是原来的默认密码。

首先引入Prometheus数据源

然后保存并且测试,这样数据源就配置完成了。接下来,我们引入新的dashboard界面。

2.引入新的dashboard

这次我们引入的是16098这个dashboard

引入这个dashboard模板之后,我们直接浏览这个dashboard界面。当时任何数据都看不到这是为什么呢,因为这个dashboard引入的变量,我们是没有的,我必须进行修改。

我们能看到origin_prometheus这个变量在Prometheus的Target label中是没有的,所以这个dashboard使用不了,那么我们怎么去改呢?

我们打开Prometheus的target查看哪个变量与这个origin_prometheus相近。通过查找node的target,只有kubernetes_io_hostname这个变量是与origin_prometheus一样的。

接下来我们修改dashboard的变量使用。打开dashboard的json源码,把里面所有的origin_prometheus替换成kubernetes_io_hostname。

接下来重新浏览dashboard数据是不是都有了

但是还是不够完美,最上面的所有节点汇总没有,我们需要加入节点汇总变量。

这样所有数据统计就都是完美的了。

相关推荐
Alluxio1 小时前
Alluxio + OCI:为 AI 工作负载实现亚毫秒访问延迟与可扩展吞吐
运维·数据库·人工智能·分布式·缓存·ai·语言模型
kuroomi4 小时前
Git入门
git·kubernetes
闲云野鹤在人间5 小时前
Prometheus入门|搭建Prometheus+Node‑Exporter+Grafana完整主机监控平台
grafana·prometheus
Sayai6 小时前
Neo4j 图数据质量检查实战:环路检测、孤立节点与连通分量,两条 Cypher 引出的数据体检清单(含变长路径性能陷阱)
运维·neo4j·图数据库·数据质量·cypher
Elastic 中国社区官方博客7 小时前
更少的位数,相同的召回率:DiskBBQ 更保守的自动校准扫描
大数据·运维·开发语言·人工智能·elasticsearch·搜索引擎
方便面不加香菜7 小时前
Docker Volume -- 管理卷Volume详解
运维·docker·容器
沫璃染墨7 小时前
从零入门计算机网络系列(十八):TCP连接管理详解——从三次握手与四次挥手到TIME_WAIT机制
运维·服务器·网络·c++·网络协议·tcp/ip·tcp
Felven7 小时前
华为鲲鹏920s芯片serdestool工具使用说明
linux·运维·服务器·华为·鲲鹏920·serdestool
江湖有缘8 小时前
Docker实战 | 使用Docker部署lemonitor镜像站点列表程序
运维·docker·容器
莫晓燚8 小时前
mall 电商项目完整部署---实战
linux·运维·docker·容器