15.4. 将出口 IP 分配给命名空间
运行以下命令来创建新项目:
$ oc new-project demo-egress-ns
运行以下命令,为命名空间中的所有 pod 创建出口规则:
$ cat <<EOF | oc apply -f - apiVersion: k8s.ovn.org/v1 kind: EgressIP metadata: name: demo-egress-ns spec: # NOTE: these egress IPs are within the subnet range(s) in which my worker nodes # are deployed. egressIPs: - 10.10.100.253 - 10.10.150.253 - 10.10.200.253 namespaceSelector: matchLabels: kubernetes.io/metadata.name: demo-egress-ns EOF