使用Elasticsearch和Kibana进行集群级别日志记录在kubernetes中不起作用

时间:2015-11-03 20:51:23

标签: elasticsearch docker kibana kubernetes

我正在尝试按照以下链接

设置群集日志记录

http://kubernetes.io/v1.0/docs/getting-started-guides/logging-elasticsearch.html

我的config-default.sh

# Optional: Enable node logging.
ENABLE_NODE_LOGGING=**true**

LOGGING_DESTINATION=${LOGGING_DESTINATION:-**elasticsearch**}

# Optional: When set to true, Elasticsearch and Kibana will be setup as part of the cluster bring up.
ENABLE_CLUSTER_LOGGING=true

ELASTICSEARCH_LOGGING_REPLICAS=${ELASTICSEARCH_LOGGING_REPLICAS:-1}

命令

$ sudo kubectl get pods --namespace=kube-system

NAME                READY     STATUS    RESTARTS   AGE

kube-dns-v9-epplg   4/4       Running   0          20h

kube-ui-v3-i4von    1/1       Running   0          18h

正如您所看到的,我启用了日志记录并设置了logging destination = elasticsearch。当我获得pod时,我没有看到elasticsearch-logging或fluentd-elasticsearch或kibana-logging。似乎没有创建复制控制器,服务或pod,我是否需要做任何其他事情来调出ElasticSearch和Kibana?

1 个答案:

答案 0 :(得分:2)

你在哪里开始你的集群?我尝试使用1.0.7版本和HEAD在GCE上重现这个并且无法实现。

使用1.0.7版本:

$ kubectl get pods --namespace=kube-system
NAME                                           READY     STATUS    RESTARTS   AGE
elasticsearch-logging-v1-6x82b                 1/1       Running   0          3m
elasticsearch-logging-v1-s4bj5                 1/1       Running   0          3m
fluentd-elasticsearch-kubernetes-minion-ijpr   1/1       Running   0          1m
fluentd-elasticsearch-kubernetes-minion-nrya   1/1       Running   0          2m
fluentd-elasticsearch-kubernetes-minion-ppls   1/1       Running   0          1m
fluentd-elasticsearch-kubernetes-minion-sy4x   1/1       Running   0          2m
kibana-logging-v1-6qka9                        1/1       Running   0          3m
kube-dns-v8-9hyzm                              4/4       Running   0          3m
kube-ui-v1-11r3b                               1/1       Running   0          3m
monitoring-heapster-v6-4uzam                   1/1       Running   1          3m
monitoring-influx-grafana-v1-euc3a             2/2       Running   0          3m

从头开始:

$ kubectl get pods --namespace=kube-system
NAME                                           READY     STATUS    RESTARTS   AGE
elasticsearch-logging-v1-9gqs8                 1/1       Running   0          3m
elasticsearch-logging-v1-edb97                 1/1       Running   0          3m
etcd-server-events-kubernetes-master           1/1       Running   0          3m
etcd-server-kubernetes-master                  1/1       Running   0          3m
fluentd-elasticsearch-kubernetes-master        1/1       Running   0          2m
fluentd-elasticsearch-kubernetes-minion-6id6   1/1       Running   0          1m
fluentd-elasticsearch-kubernetes-minion-n25a   1/1       Running   0          1m
fluentd-elasticsearch-kubernetes-minion-x4wa   1/1       Running   0          1m
heapster-v10-ek03n                             1/1       Running   0          3m
kibana-logging-v1-ybsad                        1/1       Running   0          3m
kube-apiserver-kubernetes-master               1/1       Running   0          3m
kube-controller-manager-kubernetes-master      1/1       Running   0          3m
kube-dns-v9-dkmad                              4/4       Running   0          3m
kube-scheduler-kubernetes-master               1/1       Running   0          3m
kube-ui-v3-mt7nw                               1/1       Running   0          3m
l7-lb-controller-b56yf                         2/2       Running   0          3m
monitoring-influxdb-grafana-v2-lxufh           2/2       Running   0          3m

我在config-default.sh中唯一更改的是从gcp到elasticsearch的KUBE_LOGGING_DESTINATION变量:

$ git diff cluster/gce/config-default.sh
diff --git a/cluster/gce/config-default.sh b/cluster/gce/config-default.sh
index fd31820..2e37ebc 100755
--- a/cluster/gce/config-default.sh
+++ b/cluster/gce/config-default.sh
@@ -58,7 +58,7 @@ ENABLE_CLUSTER_MONITORING="${KUBE_ENABLE_CLUSTER_MONITORING:-googleinfluxdb}"

 # Optional: Enable node logging.
 ENABLE_NODE_LOGGING="${KUBE_ENABLE_NODE_LOGGING:-true}"
-LOGGING_DESTINATION="${KUBE_LOGGING_DESTINATION:-gcp}" # options: elasticsearch, gcp
+LOGGING_DESTINATION="${KUBE_LOGGING_DESTINATION:-elasticsearch}" # options: elasticsearch, gcp

 # Optional: When set to true, Elasticsearch and Kibana will be setup as part of the cluster bring up.
 ENABLE_CLUSTER_LOGGING="${KUBE_ENABLE_CLUSTER_LOGGING:-true}"