3.安装可视化工具kibana

作者

微信:tangy8080
电子邮箱:[email protected]
更新时间: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

猜你喜欢

转载自www.cnblogs.com/gytangyao/p/11407224.html
今日推荐