Issue generating token after adding PV

Hello,
Im trying to configure a new instance of elasticsearch and kibana in docker.
When i run it with the following commands, everything runs smoothly and im able to run kibana with security enabled:

docker run --name elastic --restart unless-stopped --net elk -d -p 9200:9200 -p 9300:9300 -e discovery.type=single-node -e ES_JAVA_OPTS="-Xms2g -Xmx4g" -e ELASTIC_PASSWORD=<PW> -it docker.elastic.co/elasticsearch/elasticsearch:8.5.0

docker run --name kibana --restart unless-stopped --net elk -p 5601:5601 -e SERVER_NAME='elk02t.domain.local' docker.elastic.co/kibana/kibana:8.5.0

docker exec -it elastic /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana

The issue is, that i want to use a Persistent Volume for data. Once i put an option for it, im not able to generate the token, and getting error.
Command i use:
docker run --name elastic --restart unless-stopped --net elk -d -p 9200:9200 -p 9300:9300 -v '/var/lib/docker/esdata:/usr/share/elasticsearch/data' -e discovery.type=single-node -e ES_JAVA_OPTS="-Xms2g -Xmx4g" -e ELASTIC_PASSWORD=<PW> -it docker.elastic.co/elasticsearch/elasticsearch:8.5.0

docker exec -it elastic /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana

Output from generating the token:
ERROR: [xpack.security.enrollment.enabled] must be set to true to create an enrollment token

Could you please help me with this issue? Im able to generate the token, but once a use a Persistent volume for data, it says that the option needs to set to true.
I also tried to add the option xpack.security.enrollment.enabled: true to elasticsearch.yml, but it did not fix my issue,
thank you

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.