You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We did this in a previous example, but let's do it once again and focus on the networking perspective.
38
38
Create an nginx Pod, and note that it has a container port specification:
39
39
-->
40
-
## 在集群中暴露 Pod
40
+
## 在集群中暴露 Pod {#exposing-pods-to-the-cluster}
41
41
42
42
我们在之前的示例中已经做过,然而让我们以网络连接的视角再重做一遍。
43
43
创建一个 Nginx Pod,注意其中包含一个容器端口的规约:
@@ -66,9 +66,10 @@ Check your pods' IPs:
66
66
检查 Pod 的 IP 地址:
67
67
68
68
```shell
69
-
kubectl get pods -l run=my-nginx -o yaml | grep podIP
70
-
podIP: 10.244.3.4
71
-
podIP: 10.244.2.5
69
+
kubectl get pods -l run=my-nginx -o custom-columns=POD_IP:.status.podIPs
70
+
POD_IP
71
+
[map[ip:10.244.3.4]]
72
+
[map[ip:10.244.2.5]]
72
73
```
73
74
74
75
<!--
@@ -77,7 +78,7 @@ You should be able to ssh into any node in your cluster and use a tool such as `
77
78
You can read more about the [Kubernetes Networking Model](/docs/concepts/cluster-administration/networking/#the-kubernetes-network-model) if you're curious.
78
79
-->
79
80
你应该能够通过 ssh 登录到集群中的任何一个节点上,并使用诸如 `curl` 之类的工具向这两个 IP 地址发出查询请求。
80
-
需要注意的是,容器不会使用该节点上的 80 端口,也不会使用任何特定的 NAT 规则去路由流量到 Pod 上。
81
+
需要注意的是,容器 **不会** 使用该节点上的 80 端口,也不会使用任何特定的 NAT 规则去路由流量到 Pod 上。
0 commit comments