Unable to retrieve version information from Elasticsearch nodes. connect ECONNREFUSED

Hi everyone
I'm trying setup SSL, TLS, HTTPS for my Elasticsearch and kibana container, 2 container ES and Kibana are all the same version (8.1.3) and run at localhost.
I'm edited the configure host file locally in /etc/hosts path:       kibana.local logstash.local elastic.local localhost

I use "docker-compose up -d" and exec to ES container for create CA, certs.
In /usr/share/Elasticsearch path i create new file with name "instance.yml":

  - name: 'elasticsearch'
    dns: [ 'elastic.local' ]
  - name: 'kibana'
    dns: [ 'kibana.local' ]
  - name: 'logstash'
    dns: [ 'logstash.local' ]

and i use command to create CA&cert:

bin/elasticsearch-certutil ca --pem --out config/certs/ca-cert.zip
unzip config/certs/ca-cert.zip
bin/elasticsearch-certutil cert --ca-cert /usr/share/elasticsearch/config/certs/ca/ca.crt --ca-key /usr/share/elasticsearch/config/certs/ca/ca.key --pem --days 3650 --in instance.yml --out config/certs/elastic-stack.zip
unzip config/certs/elastic-stack.zip

Inside "/usr/share/Elasticsearch/config/certs" path will have like this:

Here is my Elasticsearch.yml configure:

cluster.name: "docker-cluster"

xpack.license.self_generated.type: basic
xpack.security.enabled: true

xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.key: certs/elasticsearch/elasticsearch.key
xpack.security.transport.ssl.certificate: certs/elasticsearch/elasticsearch.crt
xpack.security.transport.ssl.certificate_authorities: certs/ca/ca.crt

xpack.security.http.ssl.enabled: true
xpack.security.http.ssl.verification_mode: certificate
xpack.security.http.ssl.key: certs/elasticsearch/elasticsearch.key
xpack.security.http.ssl.certificate: certs/elasticsearch/elasticsearch.crt
xpack.security.http.ssl.certificate_authorities: certs/ca/ca.crt

And here is my kibana.yml configure:

server.name: kibana
server.host: kibana.local

elasticsearch.hosts: [ "https://elastic.local:9200" ]

elasticsearch.username: kibana_system
elasticsearch.password: ${KIBANA_SYSTEM_PASSWORD}

#xpack.security.enabled: true
server.ssl.enabled: true
server.ssl.certificate: /usr/share/kibana/config/certs/kibana.crt
server.ssl.key: /usr/share/kibana/config/certs/kibana.key
elasticsearch.ssl.certificateAuthorities: /usr/share/kibana/config/certs/ca/ca.crt

After that i restart 2 container ES and Kibana. I use command below here to test connect to Elasticsearch with https and ssl.

curl --cacert certs/ca/ca.crt -u elastic 'https://elastic.local:9200'

I success connect to ES with SSL and HTTPS but in kibana log i saw the error log:

Unable to retrieve version information from Elasticsearch nodes. connect ECONNREFUSED

I try exec to kibana container and add " kibana.local logstash.local elastic.local localhost" to "/etc/hosts" path but Kibana still not working.
It seems I am misunderstanding some step, can anyone here help me to solve this problem, I have tried searching but it does not bring me the desired results.
Thanks all!

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