努力挣扎的生活 努力挣扎的生活
  • 前端文章

    • JavaScript
  • 学习笔记

    • 《JavaScript教程》
    • 《JavaScript高级程序设计》
    • 《ES6 教程》
    • 《Vue》
    • 《React》
    • 《TypeScript 从零实现 axios》
    • 《Git》
    • TypeScript
    • JS设计模式总结
  • 运维基础
  • 监控
  • 日志系统
  • gitlab安装
  • jenkins安装和管理
  • Jenkins工具集成
  • pipeline流水线
  • Docker
  • Kubernetes
  • Nexus
  • Rancher
  • Prometheus
  • ELK(EFK)
  • 虚拟化
  • Mysql
  • PostgreSQL
  • Redis
  • MongoDB
  • clickhouse
关于
  • 分类
  • 标签
  • 归档
  • 收藏
  • 更多
GitHub (opens new window)

yangfk

瑟瑟发抖的小运维
  • 前端文章

    • JavaScript
  • 学习笔记

    • 《JavaScript教程》
    • 《JavaScript高级程序设计》
    • 《ES6 教程》
    • 《Vue》
    • 《React》
    • 《TypeScript 从零实现 axios》
    • 《Git》
    • TypeScript
    • JS设计模式总结
  • 运维基础
  • 监控
  • 日志系统
  • gitlab安装
  • jenkins安装和管理
  • Jenkins工具集成
  • pipeline流水线
  • Docker
  • Kubernetes
  • Nexus
  • Rancher
  • Prometheus
  • ELK(EFK)
  • 虚拟化
  • Mysql
  • PostgreSQL
  • Redis
  • MongoDB
  • clickhouse
关于
  • 分类
  • 标签
  • 归档
  • 收藏
  • 更多
GitHub (opens new window)
  • Docker

  • Kubernetes

  • Nexus

  • Rancher

  • Prometheus

    • K8s 部署Prometheus (一)
    • k8s-部署Prometheus(二)
    • k8s-部署Grafana
    • k8s-监控数据grafana展示
      • 登录Grafana
        • 配置prometheus.yml
        • 刷新Prometheus配置
        • 配置grafana数据源(prometheus)
        • 总图
      • 个人存储下载地址。。。
  • ELK

  • 虚拟化

//
  • 云计算虚拟化
  • Prometheus
yangfk
2022-06-05

k8s-监控数据grafana展示

//

# 登录Grafana

默认账号密码:admin/admin,grafana.yfklife.cn

grafana官方查找合适的dashboard (opens new window)

  • 交互登录grafana POD 安装插件
kubectl exec -it -n devops  $(kubectl get pod -n devops |grep grafana  |awk '{print $1}') bash  #登录grafana容 器
# 安装grafana插件
grafana-cli plugins install grafana-kubernetes-app
grafana-cli plugins install grafana-clock-panel
grafana-cli plugins install grafana-piechart-panel
grafana-cli plugins install briangann-gauge-panel
grafana-cli plugins install natel-discrete-panel
exit  # 退出容器
kubectl delete pod -n devops  $(kubectl get pod -n devops |grep grafana  |awk '{print $1}') # 删除pod,重新启动一个
1
2
3
4
5
6
7
8
9

# 配置prometheus.yml

prometheus官方地址 (opens new window)

global:
  scrape_interval:     15s
  evaluation_interval: 15s
  scrape_timeout: 10s
alerting:
  alertmanagers:
    - static_configs:
        - targets: ["alertmanager"]
rule_files:
- "/data/etc/rules.yml"

scrape_configs:
- job_name: 'etcd'
  tls_config:
    ca_file: /data/etc/ca.pem
    cert_file: /data/etc/client.pem
    key_file: /data/etc/client-key.pem
  scheme: https
  static_configs:        # 静态配置
  - targets:
    - '192.168.14.12:2379'
    - '192.168.14.21:2379'
    - '192.168.14.22:2379'

#------部分省略

- job_name: 'node'
  kubernetes_sd_configs:
  - role: node
  relabel_configs:
  - action: labelmap
    regex: __meta_kubernetes_node_label_(.+)
  - source_labels: [__meta_kubernetes_node_name]
    regex: (.+)
    target_label: __address__
    replacement: ${1}:9100
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
  • 参考配置

http://xxxxxxxxx/plugins/grafana-kubernetes-app/page/cluster-config ,改成你的grafana地址

prometheus1

# 刷新Prometheus配置

curl -X POST http://prometheus.yfklife.cn/-/reload

# 配置grafana数据源(prometheus)

  • 启用【kubernetes】插件,点击左边【k8s图标】,点击 【New Clusters】

复制证书 client证书为/root/.kube/config,需要对其进行解码,我这里是二进制安装的,目录文件有点不一样

ca.pem ,client.pem ,client-key.pem

cat /opt/kubernetes/server/bin/conf/kubelet.kubeconfig | grep certificate-authority-data | cut -d ' ' -f 6 | base64 -d
cat /opt/kubernetes/server/bin/conf/kubelet.kubeconfig | grep client-certificate-data | cut -d ' ' -f 6 | base64 -d
cat /opt/kubernetes/server/bin/conf/kubelet.kubeconfig | grep client-key-data | cut -d ' ' -f 6 | base64 -d

1
2
3
4
  • prometheus 数据源(tls 首字母)

prometheus1

  • k8s 数据源

prometheus1

  • 导入kubernetes的dashboard

prometheus1

  • kubernetes 集群列表

prometheus1

  • 单个kubernetes集群信息

prometheus1

# 总图

prometheus1

# 个人存储下载地址。。。

点击,获取下面下载资源

Etcd Dashboard.json               
Generic Dashboard.json            
JMX Dashboard.json                
K8s Cluster-1654615558074.json    
K8s Container-1654615571071.json
K8s Deployments-1654615540645.json
K8s Node-1654615581771.json
Traefik Dashboard.json
prometheus.yml
1
2
3
4
5
6
7
8
9

如果对你有帮助,给博主买杯咖啡吧🤞🤞

//
如果此文章对您有帮助,点击 -->> 请博主喝咖啡 (opens new window)
上次更新: 2023/11/20, 16:23:11
k8s-部署Grafana
microservices-platform项目部署

← k8s-部署Grafana microservices-platform项目部署→

最近更新
01
Linux Polkit 权限提升漏洞(CVE-2021-4034)
03-28
02
postgreSQL维护
03-17
03
trivy系统漏洞扫描
02-25
更多文章>
Theme by Vdoing | Copyright © 2019-2025 yangfk | 湘ICP备2021014415号-1
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式
×
//