我正在使用 Kubernetes 集群,使用ACS-engine部署在 Azure 上。我的集群由 5 个节点组成。
我创建了一个由以下 YAML 定义的unix pod:
Name: ping-with-unix
Node: k8s-linuxpool1-25103419-0/10.240.0.5
Start Time: Fri, 30 Jun 2017 14:27:28 +0200
Status: Running
IP: 10.244.2.6
Controllers: <none>
Containers:
ping-with-unix-2:
Container ID:
Image: willfarrell/ping
Port:
State: Running
Started: Fri, 30 Jun 2017 14:27:29 +0200
Ready: True
Restart Count: 0
Environment:
HOSTNAME: google.com
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-1nrh5 (ro)
Conditions:
Type Status
Initialized True
Ready True
PodScheduled True
Volumes:
default-token-1nrh5:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-1nrh5
Optional: false
QoS Class: BestEffort
Node-Selectors: beta.kubernetes.io/os=linux
Tolerations: <none>
Events: <none>
此 Pod 无法访问 Internet。
2017-06-30T12:27:29.512885000Z ping google.com every 300 sec
2017-06-30T12:27:29.521968000Z PING google.com (172.217.17.78): 56 data bytes
2017-06-30T12:27:39.698081000Z --- google.com ping statistics ---
2017-06-30T12:27:39.698305000Z 1 packets transmitted, 0 packets received, 100% packet loss
我创建了第二个 pod,目标是windows 容器,带有自定义 docker 图像。此图像实例化一个 HttpClient 并请求一个端点。它也没有互联网接入。我可以访问容器以运行交互式 PowerShell。我无法访问任何 DNS(由于无法访问互联网)。
PS C:\app> ping github.com
Ping request could not find host github.com. Please check the name and try again.
PS C:\app> ping 192.30.253.112
Pinging 192.30.253.112 with 32 bytes of data:
Request timed out.
Request timed out.
Ping statistics for 192.30.253.112:
Packets: Sent = 2, Received = 0, Lost = 2 (100% loss),
Control-C
我必须配置什么才能允许我的容器访问互联网?
备注:我没有定义任何网络策略。
我已经使用 api 版本“2017-07-01”和 kubernetes 版本“1.6.6”更新了我的集群。我的 unix 和 windows pod 都可以访问 Internet。
请注意,对于 Windows pod:
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句