linux運維、架構之路-K8s集群日志監控


一、EFK介紹

         k8s開發了一個Elasticsearch附加組件來實現集群的日志管理。分別為:Elasticsearch、Fluentd和Kibana的組合。

  • Elasticsearch是一個搜索引擎
  • Fluentd負責從K8s收集日志並發送給Elasticsearch
  • Kibana提供了一個Web GUI,用戶可以瀏覽和搜索存儲在Elasticsearch中的日志

二、部署

          Elasticsearch會作為k8s的應用在集群中運行,其YAML配置文件可以從 https://github.com/kubernetes/kubernetes/tree/master/cluster/addons/fluentd-elasticsearch 獲取。

 

 1、下載YAML文件放到/app/addons目錄中

[root@k8s-node1 addons]# ll
總用量 632
-rw-r--r-- 1 root root  75357 1月  15 14:48 es-service.yaml
-rw-r--r-- 1 root root 103494 1月  15 14:48 es-statefulset.yaml
-rw-r--r-- 1 root root 189617 1月  15 14:48 fluentd-es-configmap.yaml
-rw-r--r-- 1 root root 109219 1月  15 14:48 fluentd-es-ds.yaml
-rw-r--r-- 1 root root  85657 1月  15 14:48 kibana-deployment.yaml
-rw-r--r-- 1 root root  69946 1月  15 14:49 kibana-service.yaml

2、修改kibana-deployment.yaml配置

 

 部署:

[root@k8s-node1 app]# kubectl apply -f addons/
service "elasticsearch-logging" created
serviceaccount "elasticsearch-logging" created
clusterrole.rbac.authorization.k8s.io "elasticsearch-logging" created
clusterrolebinding.rbac.authorization.k8s.io "elasticsearch-logging" created
statefulset.apps "elasticsearch-logging" created
configmap "fluentd-es-config-v0.2.0" created
serviceaccount "fluentd-es" created
clusterrole.rbac.authorization.k8s.io "fluentd-es" created
clusterrolebinding.rbac.authorization.k8s.io "fluentd-es" created
daemonset.apps "fluentd-es-v2.8.0" created
deployment.apps "kibana-logging" created
service "kibana-logging" created


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM