metricbeat kubernetes DNS 查找失败:没有这样的主机

metricbeat kubernetes DNS lookup failure: no such host

我在 GCP kubernetes 集群上尝试 运行 官方 metricbeat docker 图像作为 deamonset 描述(https://www.elastic.co/guide/en/beats/metricbeat/current/running-on-kubernetes.html)并更改了设置,因此它应该将流量路由到现有的弹性搜索窗格,但我不断收到错误消息:

2018-02-22T14:04:54.515Z    WARN    transport/tcp.go:36 DNS lookup failure "elasticsearch-logging.kube-system.svc.cluster.local": lookup elasticsearch-logging.kube-system.svc.cluster.local: no such host
2018-02-22T14:04:55.516Z    ERROR   pipeline/output.go:74   Failed to connect: Get http://elasticsearch-logging.kube-system.svc.cluster.local:9200: lookup elasticsearch-logging.kube-system.svc.cluster.local: no such host
2018-02-22T14:04:55.517Z    WARN    transport/tcp.go:36 DNS lookup failure "elasticsearch-logging.kube-system.svc.cluster.local": lookup elasticsearch-logging.kube-system.svc.cluster.local: no such host
2018-02-22T14:04:57.517Z    ERROR   pipeline/output.go:74   Failed to connect: Get http://elasticsearch-logging.kube-system.svc.cluster.local:9200: lookup elasticsearch-logging.kube-system.svc.cluster.local: no such host
2018-02-22T14:04:57.519Z    WARN    transport/tcp.go:36 DNS lookup failure "elasticsearch-logging.kube-system.svc.cluster.local": lookup elasticsearch-logging.kube-system.svc.cluster.local: no such host
2018-02-22T14:05:01.519Z    ERROR   pipeline/output.go:74   Failed to connect: Get http://elasticsearch-logging.kube-system.svc.cluster.local:9200: lookup elasticsearch-logging.kube-system.svc.cluster.local: no such host
2018-02-22T14:05:01.532Z    WARN    transport/tcp.go:36 DNS lookup failure "elasticsearch-logging.kube-system.svc.cluster.local": lookup elasticsearch-logging.kube-system.svc.cluster.local: no such host

主机名没问题,因为其他 pods 已成功将数据推送到弹性。现在,经过一些研究,这证明是 Golang DNS 解析器(而不是 metricbeat 本身)的问题。 还有其他人 运行 了解这个问题吗?有人有解决方案吗?

我们遇到了同样的问题,解决方法是添加这个

hostNetwork: true  
dnsPolicy: ClusterFirstWithHostNet  

在与容器标记相同级别的 DaemonSet yaml 中