在CentOS上监控和收集Kubernetes(k8s)集群的日志,通常需要使用专门的监控和日志收集工具。以下是一些常用的方法和工具:
Prometheus
helm repo add grafana https://grafana.github.io/helm-charts
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install prometheus prometheus-community/prometheus
helm install grafana grafana/grafana
kubectl get servicemonitor -n monitoring
查看监控项目。每个监控项目下有很多监控子项,如prometheus-kube-prometheus-apiserver
监控Kubernetes API Server的性能和健康状态。Cockpit
yum install cockpit
systemctl start cockpit
systemctl enable cockpit
firewall-cmd --permanent --zone=public --add-service=cockpit
firewall-cmd --reload
http://<your-server-ip>:9090
。ELK Stack(Elasticsearch, Logstash, Kibana)
helm repo add elastic https://helm.elastic.co
helm repo update
helm install elasticsearch elastic/elasticsearch
helm install logstash elastic/logstash
helm install kibana elastic/kibana
EFK Stack(Elasticsearch, Fluentd, Kibana)
helm repo add fluentd https://helm.fluentd.org
helm repo update
helm install fluentd fluentd/fluentd
helm install elasticsearch elastic/elasticsearch
helm install kibana elastic/kibana
通过上述方法,可以在CentOS上有效地监控Kubernetes集群的状态和收集日志,从而更好地进行运维和管理。
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: centos postgresql函数应用