I try to figure out how to configure a Java RESTClient to access ES 7.17 deployed on Kubernetes, more precisely how to [set several hosts](Initialization | Elasticsearch Java API Client [7.17] | Elastic and take advantage of the [retry mechanism implemented in the RestClient](RestClient - elasticsearch-rest-client 7.17.9 javadoc.
But how to set the hosts when ES is deployed on Kubernetes and queried via services?
eck-es-data ClusterIP None <none> 9200/TCP eck-es-discovery-1 ClusterIP None <none> 9300/TCP eck-es-http ClusterIP 10.100.26.250 <none> 9200/TCP eck-es-master ClusterIP None <none> 9200/TCP eck-es-transport ClusterIP None <none> 9300/TCP
eck-es-data-0 eck-es-data-1 eck-es-data-2 eck-es-master-0 eck-es-master-1 eck-es-master-2
Using the service eck-es-http:9200 should be incorrect as the client would see it as a single host.
Could adding each of the pods eck-es-data-0/1/2 lead to unexpected behavior if the ES is scaled or if they are restarted?
Could the headless service eck-es-data be used to get all the data node addresses?