Configuring Elasticsearch cluster
From the output of kubectl describe pods
(or kubectl get pod
), we can see that the IP address of the Pod named elasticsearch-699c7dd54f-n5tmq
is listed as 172.17.0.5
. Since our machine is the node that this Pod runs on, we can access the Pod using this private IP address.
The Elasticsearch API should be listening to port 9200
. Therefore, if we make a GET
request to http://172.17.0.5:9200/
, we should expect Elasticsearch to reply with a JSON object:
$ curl http://172.17.0.5:9200/ { "name" : "CKaMZGV", "cluster_name" : "docker-cluster", "cluster_uuid" : "dCAcFnvOQFuU8pTgw4utwQ", "version" : { "number" : "6.3.2", "lucene_version" : "7.3.1" ... }, "tagline" : "You Know, for Search" }
We can do the same for Pods elasticsearch-699c7dd54f-pft9k
and elasticsearch-699c7dd54f-pm2wz
, which have the IPs 172.17.0.4
and 172.17.0.6
, respectively:
$ kubectl get pods -l app=elasticsearch -o=custom-columns=NAME:.metadata.name,IP:.status.podIP NAME IP...