Can't reach ElasticSearch installed on Kubernetes

3/1/2019

This is the official command to create elasticsearch on docker:

$ docker run -d --name elasticsearch --net somenetwork -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:6.6.1

Now, I want to install ElasticSearch on single-node (one container), on Kubernetes. I wrote the following deployment yaml:

apiVersion: v1
kind: Pod
metadata:
  name: elasticsearch
spec:
  ports:
  containers:
  - name: elasticsearch
    image: elasticsearch:6.6.1
    ports:
    - containerPort: 9200
    - containerPort: 9300
    env:
    - name: discovery.type
      value: "single-node"

And when I deployed it, I got "pod/elasticsearch created", without errors. When I access the logs of the pod, I don't see errors. Now I try to access it on browser, but I don't see it. I tried localhost:9200, cluster-info:9200, publish_address:9200 (as seen in the logs)... but I can't see it. How can I access elasticsearch?

-- Yagel
docker
elasticsearch
kubernetes

1 Answer

3/1/2019

You need to have kubernetes service to expose the elasticsearch pod. I would suggest to go through this link link

-- Navneet Nandan Jha
Source: StackOverflow