I am running Elasticsearch and kibana, I am not sure of the status of my elasticsearsh cluster (if its red, yellow, or green) but it seems I need to get a token generated by elasticsearch as in the screenshot when I ran bin/elasticsearch-create-enrollment-token --scope kibana
from the right directory it errors out ERROR: Failed to determine the health of the cluster.
.

- 2,295
- 7
- 15
- 34
-
What happened when you started elasticsearch ? Is there anything in the logs that indicated that elastisearch didn’t start correctly ? You don’t _need to use_ the enrollment token, you can also configure elastisearch and kibana manually, this is just supposed to be easier. The actual problem you are facing is that elastisearch didn’t start correctly and if you can figure out why, you can move forward. Please check the logs for elastisearch and maybe update the question with relevant error messages – Yiannis Kakavas Feb 23 '22 at 14:18
7 Answers
According Ioannis Kakavas in discuss.elastic, "CLI tools extending BaseRunAsSuperuserCommand should only connect to the local node". When I run in a local node, it works. But when I run in the elasticsearch container in a cluster, it doesn't work. The solution was execute the elastic-search-reset-password
and elasticsearch-create-enrollment-token
scripts, respectively, like this (inside the elasticsearch container):
/usr/share/elasticsearch/bin/elasticsearch-reset-password -i -u elastic --url https://localhost:9200
/usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana --url https://localhost:9200

- 331
- 2
- 4
-
-
@Mahlatse yes. I'm using docker.elastic.co/elasticsearch/elasticsearch:8.3.2 image. – Davi Carrano Dec 01 '22 at 13:42
-
I encountered the same problem, and I just redid the process - unzipped the ES and kibana zip files again, and ran bin/elasticsearch in the newly created directory. Look for a message that is encapsulated in a formatted box that contains both the password for the elastic user, and the enrollment token for Kibana (the token is only valid for 30 minutes). This message will only appear once, the first time you run elasticsearch.
I proceeded to run bin/kibana for Kibana and configured it in the browser, and everything worked out from there. Hope this helps!

- 383
- 2
- 7
-
1great that this worked for you, it still not working for me after re-installations. i noticed that elasticsearch.yml file changed after running elasticseach for the first time – Mahlatse Oct 25 '22 at 08:40
I have the exact issue:
$ sudo /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic
ERROR: Failed to determine the health of the cluster.
But after I restart the elasticsearch service:
$ sudo systemctl restart elasticsearch.service
then it works:
This tool will reset the password of the [elastic] user to an autogenerated value.
The password will be printed in the console.
Please confirm that you would like to continue [y/N]y
Password for the [elastic] user successfully reset.
New value: xxxxxx

- 749
- 4
- 16
- 34
Two possible solutions:
- Make sure that you have enough disk space.
- Your VPN might be causing the issue.

- 662
- 1
- 7
- 30
-
1
-
I also feel the same, VPN seems to be causing the issue, how do we resolve it ? – Harsh Jul 17 '23 at 14:46
Try using this command:
"elasticsearch-create-enrollment-token -s kibana --url "https://localhost:9200""
I got the same error and was able to generate the token after hitting this url. Just make sure that you are inside bin folder of elasticsearch. For me the bin folder is located at "C:\Users<username>\Downloads\Apps\elasticsearch-8.7.0\bin".
Also if you are not using localhost you can replace it with the ip address(e.g. 127.0.0.1 for localhost)
I encountered the same problem, and changed http.host to 127.0.0.1 then restart the Elasticsearch, then it goes well.
By the way, Elasticsearch version 8.8.2

- 533
- 6
- 18

- 1
- 1
The enrollment Token will be present in the terminal itself. You just need to scroll up till you find it when you are installing.
The reason for the error - ERROR: Failed to determine the health of the cluster
is due to the fact that Elastic has not been installed yet and running that command is like calling a function without defining it.

- 2,060
- 2
- 8
- 16
-
20
-
1Yeah, I know it's a blood-sucking process. Let me know if you need any help. – Kshitij Agarwal Apr 15 '22 at 06:34
-
1it's was working yesterday now I start the `elastic search` today I am getting this error `Failed to determine the health of the cluster` – Azhar Uddin Sheikh Apr 26 '22 at 06:07
-