作者
微信:tangy8080
電子郵箱:914661180@qq.com
更新時間:2019-06-19 10:10:42 星期三
歡迎您訂閱和分享我的訂閱號,訂閱號內會不定期分享一些我自己學習過程中的編寫的文章
如您在閱讀過程中發現文章錯誤,可添加我的微信 tangy8080 進行反饋.感謝您的支持。
文章主題
安裝Kibana來查看ElasticSearch中的數據
前置條件
完成了本章節的第一,第二節
安裝kibana
創建授權文件
由於kibana免費版本不提供認證功能,所以在這里我們使用Basic Authentication來完成一個簡單的用戶認證
#安裝httpd,用於生成認證文件
yum -y install httpd
#創建用戶
echo "$(htpasswd -nb -C 5 kibana yourpassword)" >> auth
#在k8s中創建保密字典
kubectl create secret generic basic-auth --from-file=auth
- It's important the file generated is named auth (actually - that the secret has a key data.auth), otherwise the ingress-controller returns a 503.
- 參考鏈接:https://kubernetes.github.io/ingress-nginx/examples/auth/basic/
安裝
helm install --name kibana --set image.tag=6.7.0,persistentVolumeClaim.storageClass=nfs-client,env."ELASTICSEARCH_HOSTS"="http://elasticsearch-client:9200",ingress.enabled=true,ingress.hosts[0]="kibana.honeysuckle.site",ingress.annotations."kubernetes\.io/ingress\.class"="nginx",ingress.annotations."nginx\.ingress\.kubernetes\.io/auth-type"="basic",ingress.annotations."nginx\.ingress\.kubernetes\.io/auth-secret"="basic-auth",ingress.annotations."nginx\.ingress\.kubernetes\.io/auth-realm"="'Authentication Required - kibana'",ingress.tls[0].hosts[0]=kibana.honeysuckle.site,ingress.tls[0].secretName="ingress-secret" stable/kibana
- kibana的版本應該ElasticSearch的版本一致,https://github.com/elastic/kibana#version-compatibility-with-elasticsearch
- 6.6版本移除了elasticsearch.url,需使用elasticsearch.hosts
- ingress.enabled=true 啟用ingress
- ingress.annotations 使用nginx作為ingress控制器,並且添加了認證參數
- 這里使用了ssl連接,如有疑問.可參閱:https://www.showdoc.cc/honeysuckle?page_id=2275371802808473
- 當您使用basic-auth時,建議使用tls,否則您的用戶名和密碼可能會被竊聽,若您沒有條件支持tls,可刪除ingress.tls相關的參數
一些就緒之后,可以使用http://kibana.honeysuckle.site 打開kibana的Web界面
認證通過之后,添加一個索引匹配模式之后應該就可以看到es中的日志了
[按需]卸載
helm del --purge kibana
遇到的問題
- Another Kibana instance appears to be migrating the index.
https://github.com/elastic/kibana/issues/25806
-
EsRejectedExecutionException
原因: 說明ES索引數據的速度已經跟不上client端發送bulk請求的速度,請求隊列已滿以致開始拒絕新的請求。 這是ES集群的自我保護機制。可以適當睡眠一段時間或者將隊列設置大點。默認設置是 bulk thead pool set queue capacity =50 可以設置大點。 -
更改時間的顯示格式YYYY-MM-DD, HH:mm:ss.SSS
引用鏈接
https://github.com/elastic/kibana/issues/25806
https://github.com/elastic/kibana#version-compatibility-with-elasticsearch