Kubernetes ACS引擎:容器(pods)没有互联网接入

时间:2017-06-30 15:15:24

标签: powershell azure unix docker kubernetes

我正在使用Kubernetes群集,使用ACS-engine部署在Azure上。我的群集由5个节点组成。

  • 1 master(unix VM)(v1.6.2)
  • 2 unix agent(v1.6.2)
  • 2 windows agent(v1.6.0-alpha.1.2959 + 451473d43a2072)

我创建了一个由以下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>

此广告连播无法访问互联网。

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

我使用自定义泊坞窗图片创建了第二个广告连播,定位 Windows容器。该图像实例化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

我需要配置什么才能让我的容器访问互联网?
备注:我没有定义任何网络策略。

1 个答案:

答案 0 :(得分:0)

我已使用api版本&#39; 2017-07-01&#39;更新了我的群集。和kubernetes版本&#39; 1.6.6&#39;。我的unix和windows pod都可以访问Internet。

注意,对于Windows pods:

  • 在pod启动后2或3分钟可以使用Internet
  • 我无法将DnsPolicy设置为&#34;默认&#34;只有&#34; ClusterFirst&#34;或者&#34; ClusterFirstWithHostNet&#34;作品。