Kubernetes(1.30) 监控
安装Metrics Server
下载配置文件https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
。
增加启动参数--kubelet-insecure-tls
。
1 | apiVersion: apps/v1 |
运行配置。
1 | kubectl apply -f components.yaml |
等待十几分钟之后,CPU和Memory的使用就可以查看到了。
但是metrics server一般只是用来做弹性扩容使用,如果需要监控并且保存历史数据,还是需要使用Prometheus。
安装Prometheus Operator
参考prometheus-operator/kube-prometheus。
## Reference
>[Installing Prometheus Operator](https://prometheus-operator.dev/docs/getting-started/installation/)
>[How to monitor Kubernetes clusters with the Prometheus Operator](https://grafana.com/blog/2023/01/19/how-to-monitor-kubernetes-clusters-with-the-prometheus-operator/)