Once all ES nodes have been discovered, most API operations are propagated from one ES node to another in a peer-to-peer manner. To test this, let's repeat what we did previously and add a document to one Elasticsearch node and test whether you can access this newly indexed document from a different Elasticsearch node.
First, let's index a new document on the Elasticsearch node running inside the elasticsearch-0 Pod:
$ curl -X PUT "$(kubectl get pod elasticsearch-0 -o=jsonpath='{.status.podIP}'):9200/test/doc/1" -H 'Content-Type: application/json' -d '{"foo":"bar"}'
{"_index":"test","_type":"doc","_id":"1","_version":1,"result":"created","_shards":{"total":2,"successful":2,"failed":0},"_seq_no":0,"_primary_term":1}
Now, let's try to retrieve this document from another Elasticsearch node (for example, the one running inside Pod elasticsearch-1):
$ curl "$(kubectl get pod elasticsearch-1 -o=jsonpath='{.status.podIP}'):9200/test/doc/1"
{"_index":"test","_type":"doc","_id":"1","_version":1,"found":true,"_source":{"foo":"bar"}}
Try repeating the same command for elasticsearch-0 and elasticsearch-2 and confirm that you get the same result.
Amazing! We've now successfully deployed our Elasticsearch service in a distributed manner inside our Kubernetes cluster!