简体   繁体   English

Elasticsearch Kubernetes pod - 无法连接到端口 9300

[英]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:我正在尝试将我的弹性搜索 Pod 连接到端口 9200 和 9300。当我去:

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.这很奇怪,因为当我只使用端口 9200 时,一切正常,但是当我使用 9300 运行时,它失败了。

Port 9300 is binary protocol (not http) and used for node communication.端口 9300 是二进制协议(不是 http),用于节点通信。 Only port 9200 exposed the Rest Api只有端口 9200 暴露了 Rest Api

From the documentation :文档

Both Java clients talk to the cluster over port 9300, using the native Elasticsearch transport protocol.两个 Java 客户端都使用本地 Elasticsearch 传输协议通过端口 9300 与集群通信。 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.集群中的节点也通过端口 9300 相互通信。如果此端口未打开,您的节点将无法形成集群。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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