1

我使用 Kubeadm 引导集群,并添加了 weave-net

kubectl apply -f https://git.io/weave-kube

我让一切都在运行,但我无法“看到”集群内任何分配的 IP。

所以:

[centos@atomic01 ~]$ kubectl get pods --all-namespaces -o wide
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE default hello-2533203682-b5usp 1/1 Running 0 13m 10.42.0.0 atomic03 default test-701078429-ely8s 1/1 Running 1 3h 10.40.0.1 atomic02 kube-system dummy-2088944543-6i81l 1/1 Running 0 5h 192.168.150.150 atomic01 kube-system etcd-atomic01 1/1 Running 0 5h 192.168.150.150 atomic01 kube-system kube-apiserver-atomic01 1/1 Running 0 5h 192.168.150.150 atomic01 kube-system kube-controller-manager-atomic01 1/1 Running 0 5h 192.168.150.150 atomic01 kube-system kube-discovery-982812725-c1kkw 1/1 Running 0 5h 192.168.150.150 atomic01 kube-system kube-dns-2247936740-nrszw 3/3 Running 2 5h 10.32.0.2 atomic01 kube-system kube-proxy-amd64-0y8ik 1/1 Running 1 5h 192.168.150.152 atomic03 kube-system kube-proxy-amd64-57y4o 1/1 Running 0 5h 192.168.150.150 atomic01 kube-system kube-proxy-amd64-mjpik 1/1 Running 1 5h 192.168.150.151 atomic02 kube-system kube-proxy-amd64-sh3ej 1/1 Running 1 5h 192.168.150.153 atomic04 kube-system kube-scheduler-atomic01 1/1 Running 0 5h 192.168.150.150 atomic01 kube-system kubernetes-dashboard-3095304083-xwuw8 1/1 Running 1 2h 10.38.0.0 atomic04 kube-system weave-net-edur9 2/2 Running 0 1m 192.168.150.151 atomic02 kube-system weave-net-l9xp3 2/2 Running 0 1m 192.168.150.150 atomic01 kube-system weave-net-sjpui 2/2 Running 0 1m 192.168.150.153 atomic04 kube-system weave-net-xu7j5 2/2 Running 0 1m 192.168.150.152 atomic03

应该能够 ping 其他节点,但是

[centos@atomic01 ~]$ kubectl exec test-701078429-ely8s -- ping 10.42.0.0 PING 10.42.0.0 (10.42.0.0) 56(84) bytes of data. From 10.40.0.1 icmp_seq=1 Destination Host Unreachable From 10.40.0.1 icmp_seq=2 Destination Host Unreachable From 10.40.0.1 icmp_seq=3 Destination Host Unreachable

当然,这有效:

[centos@atomic01 ~]$ kubectl exec test-701078429-ely8s -- ping 192.168.150.150 PING 192.168.150.150 (192.168.150.150) 56(84) bytes of data. 64 bytes from 192.168.150.150: icmp_seq=1 ttl=63 time=0.484 ms 64 bytes from 192.168.150.150: icmp_seq=2 ttl=63 time=0.448 ms

我已经没有想法了,任何关于要测试或注意的事情的线索将不胜感激。[在 Centos 7 Atomic VM 上运行]

4

1 回答 1

2

嗯,是否有任何 test 或 hello Pod 暴露了任何端口?您可以从测试 pod 访问 hello pod 上的端口吗?

通常,我认为 ping 不应该工作(除非您有一个处理 icmp 请求的 Pod),所以我实际上认为这里没有任何问题。

只需运行一个 Pod(最好来自 Deployment),为了简单起见,它会公开一个端口可能为 80,设置好containerPort: 80,您应该能够成功地 curl 该 Pod IP。还可以考虑使用稳定的 IP 创建一个服务,将请求负载平衡到匹配的 Pod,因为 Pod 可能会来来去去。

希望能帮助到你!

于 2017-01-06T13:36:00.043 回答