关于kubernetes:kubernetesk8s中部署-efk

5次阅读

共计 2134 个字符,预计需要花费 6 分钟才能阅读完成。

Kubernetes 开发了一个 Elasticsearch 附加组件来实现集群的日志治理。这是一个 Elasticsearch、Fluentd 和 Kibana 的组合。

Elasticsearch 是一个搜索引擎,负责存储日志并提供查问接口;

Fluentd 负责从 Kubernetes 收集日志,每个 node 节点下面的 fluentd 监控并收集该节点下面的系统日志,并将解决过后的日志信息发送给 Elasticsearch;

Kibana 提供了一个 Web GUI,用户能够浏览和搜寻存储在 Elasticsearch 中的日志。

从官网 github 仓库下载 yaml 文件

[root@hello ~/efk]# git clone https://github.com/kubernetes/kubernetes.git
[root@hello ~/efk]# kubectl create namespace logging
[root@hello ~/efk]#

执行所有 yaml 文件

[root@hello ~/efk]# cd kubernetes/cluster/addons/fluentd-elasticsearch/
[root@hello ~/efk/kubernetes/cluster/addons/fluentd-elasticsearch]# kubectl apply -f ./
namespace/logging created
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.1 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-v3.1.1 created
deployment.apps/kibana-logging created
service/kibana-logging created

查看 pod 状态:

[root@hello ~]# kubectl  get pod -n logging
NAME                              READY   STATUS    RESTARTS       AGE
elasticsearch-logging-0           1/1     Running   0              2m17s
elasticsearch-logging-1           1/1     Running   0              96s
fluentd-es-v3.1.1-qw9dj           1/1     Running   1 (97s ago)    2m16s
kibana-logging-75bd6cccf5-pskrr   1/1     Running   1 (106s ago)   2m16s
[root@hello ~]#


[root@hello ~]# kubectl  get service -n logging
NAME                    TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)             AGE
elasticsearch-logging   ClusterIP   None            <none>        9200/TCP,9300/TCP   2m41s
kibana-logging          ClusterIP   10.68.145.186   <none>        5601/TCP            2m40s
[root@hello ~]#

拜访 kibana

[root@hello ~]# kubectl proxy --address='192.168.1.11' --port=8086 --accept-hosts='^*$'
#拜访
http://192.168.1.11:8086//api/v1/namespaces/logging/services/kibana-logging/proxy/

创立一个 index-pattern 索引

默认为 logstash-* 即可,之后这里会看到日志

Linux 运维交换社区

Linux 运维交换社区,互联网新闻以及技术交换。

73 篇原创内容

公众号

https://blog.csdn.net/qq\_33921750

https://my.oschina.net/u/3981543

https://www.zhihu.com/people/…

https://segmentfault.com/u/hp…

https://juejin.cn/user/331578…

https://space.bilibili.com/35…

https://cloud.tencent.com/dev…

知乎、CSDN、开源中国、思否、掘金、哔哩哔哩、腾讯云

正文完
 0