问题一:使用Grafana查看k8s集群监控情况,提示插件未发现
解决:明显缺少插件,使用grafana-cli命令进行安装即可
root@ymt-130 k8s_installer]# kubectl -n monitoring get pod NAME READY STATUS RESTARTS AGE alertmanager-main-0 2/2 Running 0 7d1h alertmanager-main-1 2/2 Running 0 7d1h alertmanager-main-2 2/2 Running 0 7d1h appalertservice-58db89d477-tskd4 1/1 Running 0 7d grafana-7f94944d5f-g2kdx 1/1 Running 0 2d kube-state-metrics-6f56c8b966-h5gnd 3/3 Running 0 7d1h node-exporter-5xwhv 2/2 Running 0 7d1h node-exporter-8qmd9 2/2 Running 0 7d1h node-exporter-9cj9x 2/2 Running 0 7d1h node-exporter-dlkt7 2/2 Running 0 7d1h node-exporter-jbdb9 2/2 Running 0 7d1h node-exporter-kn69k 2/2 Running 0 7d1h prometheus-adapter-7bc75f6dc7-2r9rj 1/1 Running 0 7d1h prometheus-adapter-7bc75f6dc7-nnntv 1/1 Running 0 7d1h prometheus-adapter-7bc75f6dc7-rkgtn 1/1 Running 0 7d1h prometheus-k8s-0 3/3 Running 1 7d1h prometheus-k8s-1 3/3 Running 1 7d1h prometheus-operator-5bd99d6457-dlx4k 1/1 Running 0 7d1h [root@ymt-130 k8s_installer]# [root@ymt-130 k8s_installer]# kubectl -n monitoring exec -it grafana-7f94944d5f-g2kdx /usr/share/grafana/bin/grafana-cli plugins install grafana-piechart-panel installing grafana-piechart-panel @ 1.6.0 from: https://grafana.com/api/plugins/grafana-piechart-panel/versions/1.6.0/download into: /var/lib/grafana/plugins ✔ Installed grafana-piechart-panel successfully Restart grafana after installing plugins . <service grafana-server restart> [root@ymt-130 k8s_installer]# kubectl -n monitoring delete pod grafana-7f94944d5f-g2kdx pod "grafana-7f94944d5f-g2kdx" deleted
注意: 这里是容器化部署方式,grafana必须做持久化存储才可以,否则无法保存安装数据。
问题二:使用Grafana查看k8s集群监控情况,提示没有数据,或者数据显示错误
解决:这是监控指标配置错误导致,选择对应监控->edit,修改相关监控项即可。
指标变化:
io_kubernetes_container_name -> pod
node_memory_MemTotal -> node_memory_MemTotal_bytes
node_memory_MemFree -> node_memory_MemFree_bytes
node_memory_Buffers -> node_memory_Buffers_bytes
node_memory_Cached -> node_memory_Cached_bytes
node_filesystem_size -> node_filesystem_free_bytes
node_filesystem_free -> node_filesystem_free_bytes
node_cpu -> machine_cpu_cores
基础指标变化:
pod_name -> pod
container_name -> container