您好,登錄后才能下訂單哦!
這篇文章給大家介紹Kubernetes1.6.2如何部署EFK 插件,內(nèi)容非常詳細,感興趣的小伙伴們可以參考借鑒,希望對大家能有所幫助。
官方文件目錄:
https://github.com/kubernetes/kubernetes/tree/v1.6.2/cluster/addons/fluentd-elasticsearch
新加了 es-rbac.yaml
和 fluentd-es-rbac.yaml
文件,定義了 elasticsearch 和 fluentd 使用的 Role 和 RoleBinding
es-rbac.yaml
apiVersion: v1 kind: ServiceAccount metadata: name: elasticsearch namespace: kube-system --- kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1alpha1 metadata: name: elasticsearch subjects: - kind: ServiceAccount name: elasticsearch namespace: kube-system roleRef: kind: ClusterRole name: view apiGroup: rbac.authorization.k8s.io
fluentd-es-rbac.yaml
apiVersion: v1 kind: ServiceAccount metadata: name: fluentd namespace: kube-system --- kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1alpha1 metadata: name: fluentd subjects: - kind: ServiceAccount name: fluentd namespace: kube-system roleRef: kind: ClusterRole name: view apiGroup: rbac.authorization.k8s.io
將鏡像地址改為阿里云地址
registry.cn-hangzhou.aliyuncs.com/google-containers/elasticsearch:v2.4.1-1
將鏡像地址改為阿里云地址
registry.cn-hangzhou.aliyuncs.com/google-containers/fluentd-elasticsearch:1.22
將鏡像地址改為阿里云地址
registry.cn-hangzhou.aliyuncs.com/google-containers/kibana:v4.6.1-1
DaemonSet fluentd-es-v1.22
只會調(diào)度到設置了標簽 beta.kubernetes.io/fluentd-ds-ready=true
的 Node,需要在期望運行 fluentd 的 Node 上設置該標簽;
[root@cz_fbsdb500_06 efk]# kubectl get nodes NAME STATUS AGE VERSION 10.112.101.91 Ready 55d v1.6.2 10.112.101.92 Ready 55d v1.6.2 10.112.101.93 Ready 55d v1.6.2 [root@cz_fbsdb500_06 efk]# kubectl label nodes 10.112.101.93 beta.kubernetes.io/fluentd-ds-ready=true [root@cz_fbsdb500_06 efk]# kubectl get node --show-labels NAME STATUS AGE VERSION LABELS 10.112.101.91 Ready 55d v1.6.2 a=b,beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=10.112.101.91 10.112.101.92 Ready 55d v1.6.2 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=10.112.101.92 10.112.101.93 Ready 55d v1.6.2 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/fluentd-ds-ready=true,beta.kubernetes.io/os=linux,kubernetes.io/hostname=10.112.101.93
到efk的yaml文件目錄執(zhí)行
kubectl create -f .
[root@cz_fbsdb500_06 efk]# kubectl get deployment -n kube-system|grep kibana kibana-logging 1 1 1 1 5d [root@cz_fbsdb500_06 efk]# kubectl get pods -n kube-system|grep -E 'elasticsearch|fluentd|kibana' elasticsearch-logging-v1-3fmc1 1/1 Running 0 5d elasticsearch-logging-v1-zffql 1/1 Running 0 5d fluentd-es-v1.22-5mpwk 1/1 Running 0 4d kibana-logging-162986974-kz16j 1/1 Running 0 5d
kibana 第一次啟動時間比較長,差不多要等10分鐘左右。
[root@cz_fbsdb500_06 efk]# kubectl cluster-info Kubernetes master is running at https://10.112.101.90:6443 Elasticsearch is running at https://10.112.101.90:6443/api/v1/proxy/namespaces/kube-system/services/elasticsearch-logging Heapster is running at https://10.112.101.90:6443/api/v1/proxy/namespaces/kube-system/services/heapster Kibana is running at https://10.112.101.90:6443/api/v1/proxy/namespaces/kube-system/services/kibana-logging KubeDNS is running at https://10.112.101.90:6443/api/v1/proxy/namespaces/kube-system/services/kube-dns kubernetes-dashboard is running at https://10.112.101.90:6443/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard monitoring-grafana is running at https://10.112.101.90:6443/api/v1/proxy/namespaces/kube-system/services/monitoring-grafana monitoring-influxdb is running at https://10.112.101.90:6443/api/v1/proxy/namespaces/kube-system/services/monitoring-influxdb
由于 kube-apiserver 開啟了 RBAC 授權(quán),而瀏覽器訪問 kube-apiserver 的時候使用的是匿名證書,所以訪問安全端口會導致授權(quán)失敗。這里需要使用非安全端口訪問 kube-apiserver。
訪問鏈接:
http://10.112.101.90:8080/api/v1/proxy/namespaces/kube-system/services/kibana-logging
在 Settings -> Indices 頁面創(chuàng)建一個 index(相當于 mysql 中的一個 database),選中 Index contains time-based events
,使用默認的 logstash-*
pattern,點擊 Create
;
創(chuàng)建Index后,稍等幾分鐘就可以在 Discover
菜單下看到日志收集信息。
關(guān)于Kubernetes1.6.2如何部署EFK 插件就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。