OK,现在的efk基本就是搭建好了,浏览器登录kibana:
登录前先查询一哈kibana的service暴露的端口,30180是目前的端口:
[root@k8s-master ~]# k get svc -n kube-logging NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE elasticsearch ClusterIP None <none> 9200/TCP,9300/TCP 12h kibana NodePort 10.0.132.94 <none> 5601:30180/TCP 12h
不使用测试数据,我们用自己的数据
默认页面是这样的哈
选择上面那个菜单的kibana下面的Discover,进入新建索引页面,输入logstash-*:
这里选择自带的时间戳,下拉框可以选择到的
可以看一下索引是否正常,绿色表示正常的啦:
kibana下的Discover,可以看到详细的数据了
测试日志是否正确的收集:
现有这么多个pod,一哈随机挑选个pod的日志查看
[root@k8s-master ~]# kk NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES ingress-nginx ingress-nginx-admission-create-7bg96 0/1 Completed 0 44h 10.244.0.27 k8s-master <none> <none> ingress-nginx ingress-nginx-admission-patch-rpbnw 0/1 Completed 0 44h 10.244.1.15 k8s-node1 <none> <none> ingress-nginx ingress-nginx-controller-75sqz 1/1 Running 3 44h 192.168.217.16 k8s-master <none> <none> ingress-nginx ingress-nginx-controller-lkc24 1/1 Running 4 44h 192.168.217.17 k8s-node1 <none> <none> ingress-nginx ingress-nginx-controller-xjg6s 1/1 Running 3 44h 192.168.217.18 k8s-node2 <none> <none> kube-logging es-cluster-0 1/1 Running 2 41h 10.244.1.33 k8s-node1 <none> <none> kube-logging es-cluster-1 1/1 Running 0 6h1m 10.244.2.29 k8s-node2 <none> <none> kube-logging es-cluster-2 1/1 Running 2 41h 10.244.1.34 k8s-node1 <none> <none> kube-logging fluentd-d58br 1/1 Running 1 29h 10.244.1.32 k8s-node1 <none> <none> kube-logging fluentd-lrpgc 1/1 Running 1 29h 10.244.0.43 k8s-master <none> <none> kube-logging fluentd-mvpsq 1/1 Running 1 29h 10.244.2.27 k8s-node2 <none> <none> kube-logging kibana-588d597485-wljbr 1/1 Running 2 41h 10.244.0.45 k8s-master <none> <none> kube-system coredns-59864d888b-bpzj6 1/1 Running 3 46h 10.244.0.44 k8s-master <none> <none> kube-system kube-flannel-ds-4bxpd 1/1 Running 6 3d17h 192.168.217.16 k8s-master <none> <none> kube-system kube-flannel-ds-5stwc 1/1 Running 8 3d17h 192.168.217.18 k8s-node2 <none> <none> kube-system kube-flannel-ds-pg6kq 1/1 Running 7 3d17h 192.168.217.17 k8s-node1 <none> <none> kube-system nfs-client-provisioner-9c9f9bd86-tz9lk 1/1 Running 5 3d5h 10.244.2.28 k8s-node2 <none> <none>
查看kibana这个pod的日志,查询前时间改大一些
查看elasticsearch集群的日志:
查看etcd相关的日志:
OK,kubernetes搭建EFK日志系统圆满完成。