简体   繁体   中英

Elasticsearch Kubernetes pod - can't connect to port 9300

I am trying to connect my elastic search pod, to ports 9200 and 9300. When I go to:

http://localhost:$IP_FROM_KUBECTL_PROXY(usually 8001)/api/v1/namespaces/default/pods/$POD_NAME/proxy/

I see the following error:

Error: 'net/http: HTTP/1.x transport connection broken: malformed HTTP status code "is"'
Trying to reach: 'http://172.17.0.5:9300/'

What I did is, running :

kubectl run elasticsearch --image=elasticsearch:6.6.1 -labels="elasticsearch" --env="discovery.type=single-node" --port=9200 --port=9300

and running the following service:

kind: Service
apiVersion: v1
metadata:
  name: elasticsearch
spec:
  selector:
    host: elasticsearch
    subdomain: for-kibana
    app: elasticsearch
  ports:
  - protocol: TCP
    name: serving
    port: 9200
    targetPort: 9200
  - protocol: TCP
    name: node2node
    port: 9300
    targetPort: 9300

It's weird, because when I just use port 9200, all works, but when I run with 9300, its fail.

Port 9300 is binary protocol (not http) and used for node communication. Only port 9200 exposed the Rest Api

From the documentation :

Both Java clients talk to the cluster over port 9300, using the native Elasticsearch transport protocol. The nodes in the cluster also communicate with each other over port 9300. If this port is not open, your nodes will not be able to form a cluster.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM