Coreos
無法通過IP連接kubernetes的服務
我正在按照 k8s 留言簿範例 ( https://github.com/GoogleCloudPlatform/kubernetes/tree/master/examples/guestbook ) 中的步驟操作,並且我遇到了此範例中描述的前端服務的問題。
frontend-controller-182tv 10.148.3.4 ... Running 4 minutes frontend-controller-i7hvs 10.148.4.3 ... Running 4 minutes frontend-controller-zwk1b 10.148.1.4 ... Running 4 minutes
服務是:
frontend name=frontend name=frontend 10.151.244.58 8000
所以看起來不錯,但實際上我無法連接到服務IP的8000埠(來自master的telnet):
telnet 10.151.244.58 8000 Trying 10.151.244.58...
ifconfig 的輸出:
cbr0 Link encap:Ethernet HWaddr 12:1b:36:19:22:26 inet addr:10.148.0.1 Bcast:0.0.0.0 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1460 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) docker0 Link encap:Ethernet HWaddr 56:84:7a:fe:97:99 inet addr:172.17.42.1 Bcast:0.0.0.0 Mask:255.255.0.0 BROADCAST MULTICAST MTU:1460 Metric:1 RX packets:8 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:536 (536.0 B) TX bytes:0 (0.0 B) eth0 Link encap:Ethernet HWaddr 42:01:0a:f0:f8:b7 inet addr:10.240.248.183 Bcast:10.240.248.183 Mask:255.255.255.255 UP BROADCAST RUNNING MULTICAST MTU:1460 Metric:1 RX packets:76763 errors:0 dropped:0 overruns:0 frame:0 TX packets:48794 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:143685366 (137.0 MiB) TX bytes:7641852 (7.2 MiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:250900 errors:0 dropped:0 overruns:0 frame:0 TX packets:250900 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:98458614 (93.8 MiB) TX bytes:98458614 (93.8 MiB)
不知道我的錯誤在哪里或我還需要做什麼……
在我的情況下,命令看起來像
gcloud 計算路由創建 frontend-service-1-1 –destination-range 10.151.244.0/24 –next-hop-instance k8s-k8s-tds-example-node-1 –next-hop-instance-zone us-中央1-c
看起來您必須為所有節點創建路由才能使其正常工作。
附言
此外,如果您在服務中使用“createExternalLoadBalancer”,請確保在雲防火牆設置中允許從 0.0.0.0/0 到此埠的連接。