Metricbeat installing on Kubenetes cluster ERROR

I have a problem with Metricbeat installation on my cluster. I have used a kubernetes module template:https://www.elastic.co/guide/en/beats/metricbeat/master/metricbeat-module-kubernetes.html.

In this place (at the end of the kubenetes module example):
hosts: ["https://${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT}"],
I`ve inserted my Kubernetes API server host and port. When I try to run sudo metricbeat -c /etc/metricbeat/metricbeat.yml test config, I recieve this error:

Exiting: 2 errors: 1 error: fail to get kubernetes client: Unable to
get in cluster configuration: unable to load in-cluster configuration,
KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined; 1
error: metricset 'kubernetes/apiserver' is not registered, metricset
not found.

I tried to export needed enviroment varibles, but reaction was the same. Could anyone help me to solve this problem?

So, i tried different approaches. Firstly, with command export KUBERNETES_SERVICE_HOST and PORT, i defined variables, which i found using command "kubectl cluster-info", also this variables i could find in one of clusters pods yml file as "env": [ { "name": "KUBERNETES_SERVICE_HOST", "value": "xxxxx" }, { "name": "KUBERNETES_SERVICE_PORT", "value": "xxxxx".
But there were no changes in the reaction.
Secondly i tried insert ENV in metricbeat yml config file. As in privious situation, reaction didn`t changed. I also delpoyed Metricbeat as a Daemon set, using kubectl create -f metricbeat-kubernetes.yaml. All works fine. Metricbeat send info about concrete node. But for visualization in kibana, i need (i think so) to send overall information about cluster (pods, nodes and so on), installing metricbeat as service on cluster.

Hi @b22565875b81d856c5b0,

If you followed https://www.elastic.co/guide/en/beats/metricbeat/current/running-on-kubernetes.html and it's working, you only need to run metricbeat setup from any Metricbeat instance to deploy the dashboards (you can do this step from your workstation): https://www.elastic.co/guide/en/beats/metricbeat/6.3/load-kibana-dashboards.html

Best regards

If i will follow your instructions, i could get whole info about CLUSTER ( all nodes, all pods etc.)?

UP!!!

Hi,

Yes, you should get that information if you go over instructions.

Best regards