Skip to content

Pod IP 直接对外暴露

Oilbeater edited this page Aug 9, 2019 · 7 revisions

如果希望将 Pod IP 直接暴露给外部网络,以便外部可以直接通过 Pod IP 来访问容器,需要将对应子网的 natOutgoing 设置为 false。同时需要在外部的路由器上加一条静态路由,将目的地址为子网 cidr 的数据包下一跳设置为集群中的任意一台机器。

子网示例:

apiVersion: kubeovn.io/v1
kind: Subnet
metadata:
  name: subnet-gateway
spec:
  protocol: IPv4
  default: false
  namespaces:
  - ns1
  - ns2
  cidrBlock: 100.64.0.0/16
  gateway: 100.64.0.1
  excludeIps:
  - 100.64.0.1
  private: false
  gatewayType: distributed
  natOutgoing: false
Clone this wiki locally