簡體   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