2016-04-08 47 views
0

我在docker-machine上使用Kubernetes v1.2.2,並且想從另一個在同一節點上運行的普通單容器pod連接到多容器Pod。無法通過clusterIP訪問Kubernetes多容器Pod p

每個吊艙都有提供集羣IP的服務。我可以通過相應服務的clusterIP從多容器吊艙(postgres-bw-service)訪問單容器吊艙(postgres-service),但反之亦然。我查了KUBE-代理日誌,發現沒有服務端點爲我多容器吊艙的服務設置:

I0408 16:20:06.693273  1 iptables.go:177] Could not connect to D-Bus system bus: dial unix /var/run/dbus/system_bus_socket: no such file or directory 
E0408 16:20:06.703401  1 server.go:340] Can't get Node "default", assuming iptables proxy: Get http://127.0.0.1:8080/api/v1/nodes/default: dial tcp 127.0.0.1:8080: connection refused 
I0408 16:20:06.711666  1 server.go:200] Using iptables Proxier. 
I0408 16:20:06.712420  1 server.go:213] Tearing down userspace rules. 
I0408 16:20:06.822631  1 conntrack.go:36] Setting nf_conntrack_max to 262144 
I0408 16:20:06.822833  1 conntrack.go:41] Setting conntrack hashsize to 65536 
I0408 16:20:06.823646  1 conntrack.go:46] Setting nf_conntrack_tcp_timeout_established to 86400 
E0408 16:20:06.826470  1 event.go:202] Unable to write event: 'Post http://127.0.0.1:8080/api/v1/namespaces/default/events: dial tcp 127.0.0.1:8080: connection refused' (may retry after sleeping) 
E0408 16:20:08.627546  1 event.go:202] Unable to write event: 'Post http://127.0.0.1:8080/api/v1/namespaces/default/events: dial tcp 127.0.0.1:8080: connection refused' (may retry after sleeping) 
E0408 16:20:18.629129  1 event.go:202] Unable to write event: 'Post http://127.0.0.1:8080/api/v1/namespaces/default/events: dial tcp 127.0.0.1:8080: connection refused' (may retry after sleeping) 
I0408 16:20:20.925349  1 proxier.go:484] Setting endpoints for "default/kubernetes:https" to [10.0.2.15:6443] 
I0408 16:20:20.925592  1 proxier.go:484] Setting endpoints for "default/postgres-service:postgres-tcp" to [172.17.0.3:5432] 
I0408 16:20:20.925841  1 proxier.go:565] Not syncing iptables until Services and Endpoints have been received from master 
I0408 16:20:20.931213  1 proxier.go:421] Adding new service "default/kubernetes:https" at 10.0.0.1:443/TCP 
I0408 16:20:20.931901  1 proxier.go:421] Adding new service "default/postgres-bw-service:postgres" at 10.0.0.139:5432/TCP 
I0408 16:20:20.932084  1 proxier.go:421] Adding new service "default/postgres-bw-service:kafka" at 10.0.0.139:9092/TCP 
I0408 16:20:20.932203  1 proxier.go:421] Adding new service "default/postgres-bw-service:zookeeper" at 10.0.0.139:2181/TCP 
I0408 16:20:20.932331  1 proxier.go:421] Adding new service "default/postgres-service:postgres-tcp" at 10.0.0.241:5432/TCP 
I0408 16:20:22.860305  1 proxier.go:494] Removing endpoints for "default/postgres-service:postgres-tcp" 
I0408 16:20:26.582664  1 proxier.go:484] Setting endpoints for "default/postgres-service:postgres-tcp" to [172.17.0.2:5432] 

注意日誌條目Setting endpoints for "default/postgres-service:postgres-tcp" to [172.17.0.2:5432]但在爲Postgres-BW-服務沒有類似的條目。我認爲這就是爲什麼我不能訪問多容器吊艙的原因,但我不知道是什麼導致了這種情況。

更奇怪的是:我無法通過自己的服務的clusterIP訪問一個容器,這對多容器容器和單容器容器都不起作用。

任何幫助表示讚賞

編輯

kubectl get ep給我

kubectl get ep postgres-service 
NAME    ENDPOINTS   AGE 
postgres-service 172.17.0.2:5432 17h 

kubectl get ep postgres-bw-service 
NAME    ENDPOINTS   AGE 
postgres-bw-service <none>  17h 
+0

你可以發佈'kubectl get ep postgres-service'的輸出嗎?我懷疑有服務配置或與豆莢本身有問題。 –

+0

@VishnuKannan我相應地編輯了我的問題 –

回答

1

的問題是,我莢的應用程序標籤並沒有在我的服務定義應用選擇相匹配。

相關問題