Unable to connect one elasticsearch master pod to another pod to setup two node cluster

Hello Team,

I am trying to setup two node es cluster in k8s.

Issue that i am facing is that es-1 could not elect that as master and could not connect to another pod

es-2.yml file

   cluster.name: "elastic.cluster"
    network.host: _site_
    #http.host: 0.0.0.0
    node.name: "es-2-0"
    node.master: false
    node.data: true
    node.ingest: false
    discovery.seed_hosts: ["es-2-0","es-clusterip-svc-1.bat-aws-namespace-1.svc.cluster.local"]
    cluster.initial_master_nodes: ["es-clusterip-svc-1.bat-aws-namespace-1.svc.cluster.local"]
    #transport.host: 0.0.0.0
    #network.bind_host: 0.0.0.0
    #network.publish_host: es-clusterip-svc-2.bat-aws-namespace-1.svc.cluster.local
    path.data: /usr/share/elasticsearch/data
    bootstrap.memory_lock: true
    #node.roles: master
    xpack.license.self_generated.type: basic
    #Enable xpack.security which is provided in basic subscription
    xpack.security.enabled: true
    #Disable unused xpack features
    xpack.monitoring.enabled: true
    xpack.graph.enabled: true
    xpack.watcher.enabled: true
    xpack.ml.enabled: true
    logger.org.elasticsearch.cluster.coordination.ClusterBootstrapService: TRACE
    logger.org.elasticsearch.discovery: TRACE

es-1.yml file

 cluster.name: "elastic.cluster"
   network.host: _site_
   #http.host: 0.0.0.0
   node.name: "es-1-0"
   node.master: true
   node.data: false
   node.ingest: false
   discovery.seed_hosts: ["es-1-0","es-clusterip-svc-2.bat-aws-namespace-1.svc.cluster.local"]
   cluster.initial_master_nodes: ["es-1-0","es-clusterip-svc-2.bat-aws-namespace-1.svc.cluster.local"]
   #transport.host: 0.0.0.0
   #network.bind_host: 0.0.0.0
   #network.publish_host: es-clusterip-svc-1.bat-aws-namespace-1.svc.cluster.local
   path.data: /usr/share/elasticsearch/data
   bootstrap.memory_lock: true
   #node.roles: master
   xpack.license.self_generated.type: basic
   #Enable xpack.security which is provided in basic subscription
   xpack.security.enabled: true
   #Disable unused xpack features
   xpack.monitoring.enabled: true
   xpack.graph.enabled: true
   xpack.watcher.enabled: true
   xpack.ml.enabled: true
   logger.org.elasticsearch.cluster.coordination.ClusterBootstrapService: TRACE
   logger.org.elasticsearch.discovery: TRACE```

I am getting below error as 

de.name": "es-1-0", "message": "initialized" }
{"type": "server", "timestamp": "2023-10-12T12:21:28,286Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "elastic.cluster", "node.name": "es-1-0", "message": "starting ..." }
{"type": "server", "timestamp": "2023-10-12T12:21:28,729Z", "level": "INFO", "component": "o.e.t.TransportService", "cluster.name": "elastic.cluster", "node.name": "es-1-0", "message": "publish_address {10.42.0.99:9300}, bound_addresses {10.42.0.99:9300}" }
{"type": "server", "timestamp": "2023-10-12T12:21:29,260Z", "level": "INFO", "component": "o.e.b.BootstrapChecks", "cluster.name": "elastic.cluster", "node.name": "es-1-0", "message": "bound or publishing to a non-loopback address, enforcing bootstrap checks" }
ERROR: [2] bootstrap checks failed
[1]: memory locking requested for elasticsearch process but memory is not locked
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
ERROR: Elasticsearch did not exit normally - check the logs at /usr/share/elasticsearch/logs/elastic.cluster.log


But when i change network.host: 127.0.0.1 bootstrap setting is getting passed but es-1 is not getting connected with es-2.

i have learned some setting of transport.host and http.host but could not resolve this issue.

If anyone have suggestion please let me know.

Thanks in advance

You need to fix this before, I do not use k8s, but here is some documentation on how to fix that on ECK, you may need to adapt to your infrastructure if you are not using ECK.

This is expected, the bootstrap checks are triggered when you set network.host to something different from 127.0.0.1, which means you are going to production.

Hi,
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
i have commands in post start to increase vm.max_map_count value.
If container successfully stated those values would be set.

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