繁体   English   中英

流量未到达 Kubernetes 集群中的 POD

[英]Traffic is not reaching to POD in Kubernetes Cluster

我有一个使用 Docker 在 Windows 上运行的本地 Kubernetes。 在我的 Windows 主机中,我在端口 4000 上运行一个进程。

在我的 POD 中,我正在执行curl windows_host_ip:4000但无法获得响应。 正在建立来自 POD 的连接,但响应超时。 日志

  • 在 DNS 缓存中找不到主机名
  • 正在尝试 192.168.18.10...
  • 连接到 192.168.18.10 端口 4000 失败:连接被拒绝
  • 无法连接到 192.168.18.10 端口 4000:连接被拒绝
  • 关闭连接 0 curl:(7)无法连接到 192.168.18.10 端口 4000:连接被拒绝 root@ordermanagement-64694dd8b8-2ktm8:/apps/ordermanagement# curl -v http://192.168.18.10:4000/ordermanagement/order/订单
  • 在 DNS 缓存中找不到主机名
  • 正在尝试 192.168.18.10...
  • 连接到 192.168.18.10 (192.168.18.10) 端口 4000 (#0)

GET /ordermanagement/order/orders HTTP/1.1 用户代理:curl/7.38.0 主机:192.168.18.10:4000 接受: /

  • 接收失败:对等方重置连接
  • 关闭连接 0 curl: (56) Recv failure: Connection reset by peer

请让我知道如何允许来自我的主机系统的传入流量进入我的 POD

这是预期的行为。 Pod 不应该直接访问主机的网络、进程、文件系统等,否则任何闯入 Pod 的人都可以获得主机系统的全部信息,还可以获得主机中运行的其他 Pod 的完整信息。

您可以考虑为集群内的主机进程创建 Kubernetes 端点,请在此处查看此文档以手动管理服务端点

您也可以通过将 pod 作为特权pod 运行来潜在地实现这一点,但是,运行特权pod 并不是一个好的安全实践。

Privileged - determines if any container in a pod can enable privileged mode. By default, a container is not allowed to access any devices on the host, but a "privileged" container is given access to all devices on the host. This allows the container nearly all the same access as processes running on the host. This is useful for containers that want to use Linux capabilities like manipulating the network stack and accessing devices.

您可以通过将特权标志设置为true (默认情况下不允许容器访问主机上的任何设备)将 pod 转换为特权 pod。

暂无
暂无

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

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