Enable login page for basic user authetication in Kibana

Good morning,

I have the following problem. I have installed ELK version 8 on three different servers, one for each service. Now what I am trying to enable basic user authentication so that the login page is enabled in the kibana.

I have made the configuration both in the Elasticsearch.yml enabling security:

Enable security features

xpack.security.enabled: true

And in the Kibana part, add the username and password of the "kibana_system" user.

The two services are restarted, and on the Kibana side, the following appears in the log:

{"ecs":{"version":"8.0.0"},"@timestamp":"2022-06-02T09:45:15.248+01:00","message":"Unable to retrieve version information from Elasticsearch nodes.socket hang up - Local: 10.140.220.163:35512, Remote: 10.140.220.150:9200","log":{"level":"ERROR","logger":"Elasticsearch-service"},"process" :{"pid":428651},"trace":{"id":"d15c5991ae4849dfc126eb718cae1867"},"transaction":{"id":"375c4b8e2c0d9e0f"}}

And it doesn't finish booting, having to revert the changes, and logically not having access security enabled.

What is missing for a correct configuration?

Thank you very much.