how can i generate enrollment token for elasticsearch to connect with kibana?
Asked Answered
O

6

14

I am having running elastic-search on my Kubernetes cluster with host http://192.168.18.35:31200/. Now I have to connect my elastic search to the kibana. For that an enrollment token needs to be generated but how? When I login to the root directory of elastic-search from kibana dashboard and type the following command to generate a new enrollment token, it shows the error:

enter image description here

command : bin/elasticsearch-create-enrollment-token --scope kibana
error: bash: bin/elasticsearch-create-enrollment-token: No such file or directory

I have created a file elasticsearch-create-enrollment-token inside the bin directory and gave full permission. Still, no tokens are generated. Have any ideas on enrollment token guys?

Obscene answered 21/2, 2022 at 10:11 Comment(2)
Have you tried ./bin/... (i.e. add ./ ad the beginning of the command). If not, are you sure you have the elasticsearch-create-enrollment-token script in your bin folder? If that's not the case, you're running ES 7 (and not ES8)Indecency
yeah my es is 7.9 and kibana is 8Obscene
D
26

Assuming that you are on debian/ ubuntu, this should help

cd /usr/share/elasticsearch/bin/

then

./elasticsearch-create-enrollment-token --scope kibana
Dachau answered 21/2, 2022 at 22:43 Comment(1)
Note that the OP not running ES8, but ES 7.9 and Kibana 8 which are not compatibleIndecency
I
5

Since you're running ES 7.9, you also need Kibana 7.9. You cannot run Kibana 8 on ES 7.9.

That's the reason why you don't have the elasticsearch-create-enrollment-token script in your bin folder, since that's new in ES8

Indecency answered 21/2, 2022 at 10:26 Comment(0)
U
5

If you're running on Docker Desktop, say on MacOS:

  1. Make sure both Kibana and ElasticSearch are running like so:

enter image description here

  1. Click to open the running ElasticSearch Docker instance.

  2. Open the Terminal tab on the Docker Desktop and run the following command: bin/elasticsearch-create-enrollment-token -s kibana

Note: The token is only valid for 30mins.

Get more info from the docs: Create Enrolment Token

Uribe answered 8/5, 2023 at 9:20 Comment(0)
Y
1

The enrollment flow for configuration is available in version 8.0 and onwards only and is designed to work only with the TLS configuration that is generated automatically on the first start of the node.

You can still use the documentation to setup TLS manually and configure Kibana to connect to your elasticsearch cluster as you would do in previous versions, this is always supported too.

I’d strongly suggest that you look into using ECK and take advantage of the documentation available.

Yorkshire answered 22/2, 2022 at 8:0 Comment(0)
A
0

I am using elasticsearch on docker.

following this post

When everything is okay, you should connect to 127.0.0.1:5601

after then you will encounter "add token screen".

At this point follow below steps;

  1. Go to the docker desktop
  2. Make sure Elasticsearch and Kibana are running on docker
  3. go to the elasticsearch instance.
  4. Click exec tab on navbar.
  5. write this command. bin/elasticsearch-create-enrollment-token -s kibana)
  6. At this point you will a token. Copy - Paste on "add token screen"
  7. Next screen, you will encounter verification code.
  8. Go to the docker.
  9. Click on the kibana instance.
  10. Click exec tab on navbar. 11 press ctrl + f and search verification code
  11. Copy - paste verification code.
  12. After scene, you will encounter login screen. You can use these credentials. elastic and changeme . But if these credentials not work, go to the elastic instance on docker and click exec tab and paste this command. bin/elasticsearch-reset-password -u elastic and say Yes.
  13. After run this command, docker will give to you a password.
  14. copy and paste this password on login credentials. And ENJOY.!
Alfano answered 18/5, 2024 at 15:57 Comment(0)
I
0

I try this way and It works for me

go to elastic search bin path

elasticsearch-8.14.1-windows-x86_64\elasticsearch-8.14.1\bin>

and then run this command

elasticsearch-service-tokens create elastic/kibana my-token

after that, the generated token add to your kibana.yml file

elasticsearch.serviceAccountToken: "AAAAA********************"

then run kibana.bat file it works for me on port 5601

Ichnography answered 2/7, 2024 at 6:5 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.