When trying to create a node token with:

./bin/elasticsearch-create-enrollment-token -s node

If get the error:

ERROR: Unable to create an enrollment token. Elasticsearch node HTTP layer SSL configuration is not configured with a keystore, with exit code 73

After creating the ca and http:

./bin/elasticsearch-certutil ca


./bin/elasticsearch-certutil http

Do this:

cd /usr/share/elasticsearch/jdk/bin
./keytool -importkeystore -destkeystore /etc/elasticsearch/certs/http.p12 -srckeystore /usr/share/elasticsearch/elastic-stack-ca.p12 -srcstoretype PKCS12

keytool overwrite and try again, should fix the problem

Then try adding nodes with:

./elasticsearch-reconfigure-node --enrollment-token <token>

If you already installed elastic, you need to apt --purge remove elasticsearch then install again apt install elasticsearch (remove /var/lib/elasticsearch) and before starting enroll the new n