From 62735895f27ea068835bffae7c62932237a7f7c4 Mon Sep 17 00:00:00 2001 From: Pablo Mercado Date: Fri, 31 Jan 2020 12:55:29 +0100 Subject: [PATCH] Kubernetes: node autodiscover, add InternalIP (#15930) * use any node ip --- libbeat/autodiscover/providers/kubernetes/node.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libbeat/autodiscover/providers/kubernetes/node.go b/libbeat/autodiscover/providers/kubernetes/node.go index 894133f3d121..c643ae4f30c4 100644 --- a/libbeat/autodiscover/providers/kubernetes/node.go +++ b/libbeat/autodiscover/providers/kubernetes/node.go @@ -188,7 +188,6 @@ func (n *node) emit(node *kubernetes.Node, flag string) { }, } n.publish(event) - } func getAddress(node *kubernetes.Node) string { @@ -198,6 +197,12 @@ func getAddress(node *kubernetes.Node) string { } } + for _, address := range node.Status.Addresses { + if address.Type == v1.NodeInternalIP && address.Address != "" { + return address.Address + } + } + return "" }