elasticsearch on kubernetes - discovery of nodes elasticsearch on kubernetes - discovery of nodes kubernetes kubernetes

elasticsearch on kubernetes - discovery of nodes


Version 6.2.0 is supporting kubernetes auto discovery

update your elasticsearch.yml as following

discovery.zen.ping.unicast.hosts: "kubernetes service name"


There is a discovery plugin that uses the kubernetes API for cluster discovery:

https://github.com/fabric8io/elasticsearch-cloud-kubernetes

Install the plugin:

/usr/share/elasticsearch/bin/plugin -i io.fabric8/elasticsearch-cloud-kubernetes/1.3.0 --verbose

Create a Kubernetes service for discovery:

apiVersion: v1kind: Servicemetadata:  name: elasticsearch-clusterspec:  ports:    - port: 9300  selector:    app: elasticsearch

And an elasticsearch.yml:

cloud.k8s.servicedns: elasticsearch-clusterdiscovery.type: io.fabric8.elasticsearch.discovery.k8s.K8sDiscoveryModule


Place the containers into a Kubernetes Service. The Kubernetes API makes an 'endpoints' API available that lists the IP addresses of all of the members of a service. This endpoint set will dynamically shrink and grow as you scale the number of pods.

You can access endpoints with:

kubectl get endpoints <service-name>

or directly via the Kubernetes API, see:

https://github.com/kubernetes/kubernetes/blob/master/examples/cassandra/java/src/io/k8s/cassandra/KubernetesSeedProvider.java#L106

for an example of how this was done for Cassandra.