使用 tcp 服务时无法到达内部端点

Not able to reach an internal endpoint when using tcp-services

我有一个问题几天前就被屏蔽了。尝试了很多东西,但 none 有效。

我有一个 k8s 集群,其中有一个 pod 运行 corda (https://docs.corda.net/docker-image.html) 。这个 pod 公开了一个 RPC 端点 (10201),我希望能够使用 corda-shell 工具从集群外部(我的笔记本电脑)访问的端点。

所以我创建了一个入口(使用 ingress-nginx)并添加了一个看起来像这样的配置映射:

apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Release.Name }}-tcp-services
  namespace: {{ .Release.Namespace }}
data:
  10201: {{ .Release.Namespace }}/{{ .Release.Name }}-corda-node:10201

corda pod 的 service.yaml 看起来像这样:

apiVersion: v1
kind: Service
metadata:
  name: {{ include "corda-node.fullname" . }}
  labels:
{{ include "corda-node.labels" . | indent 4 }}
spec:
  type: ClusterIP
  ports:
    - port: 80
      targetPort: http
      protocol: TCP
      name: http
    - port: 10200
      targetPort: p2p
      protocol: TCP
      name: p2p
    - port: 10201
      targetPort: rpc
      protocol: TCP
      name: rpc
    - port: 10202
      targetPort: rpcadmin
      protocol: TCP
      name: rpcadmin
  selector:
    app.kubernetes.io/name: {{ include "corda-node.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}

但是到目前为止,无论我怎样尝试都无法从外部连接到它。 从集群中的另一个 pod/容器,它工作正常,就像我将端口转发到我的本地 .

注意:我可以从外部连接到集群中的其他服务。事实上,这个 corda pod 有一个 sidecar,它在 8080 上暴露了一个 API,我可以访问它。

我可以看到端口“10201”被入口暴露,所以我猜它考虑了我的 tcp 服务,但似乎无法将请求转发到 corda pod。

如果我尝试做 telnet public-ip-of-the-cluter 10201,我只是有一个超时。 运行 corda-shell 工具时相同...

据我所知,我在 ingress-controller pod 中看不到相关日志。

我用各种 'kubectl describe xxx' 命令创建了一个 small github repo,以便让您大致了解我所做的事情。

如果您需要更多信息,请问我。我真的很挣扎,很可能我在某个地方做了一些愚蠢的事情......

谢谢!

编辑:

我把 ingress 的日志放在 - --v=3 上,我可以在它启动时看到它:

I0215 09:30:32.081819 6 controller.go:333] Searching Endpoints with TCP port number 10201 for Service "salmon-locust/salmon-locust-corda-node-corda-node"
│ │ I0215 09:30:32.081836 6 endpoints.go:74] Getting Endpoints for Service "salmon-locust/salmon-locust-corda-node-corda-node" and port &ServicePort{Name:rpc,Protocol:TCP,Port:10201,TargetPort:{1 0 rpc},NodePort:0,} │ │ I0215 09:30:32.081849 6 endpoints.go:117] Endpoints found for Service "salmon-locust/salmon-locust-corda-node-corda-node": [{10.96.1.13 10201 &ObjectReference{Kind:Pod,Namespace:salmon-locust,Name:salmon-locust-corda-node-corda- │

但是当我尝试通过 corda-tools-shell.

连接时,没有 activity

编辑 2:

我们发现了问题所在,入口 -> dns 解析到未处理 1xxxx 端口的 cloudflare 代理...

入口日志中是否有任何传入请求? Ingress 可能正在寻找 http header 这可能无法正常工作 Corda RPC

我们发现了问题所在,入口 -> dns 解析到 cloudflare 代理,它没有处理 1xxxx 端口...