kubernetes externalname service not reachable by pods in docker-for-desktop windows

11/29/2019

Hello every one i have created a headless service using ExternalName type to access database residing outside my cluster but i am not able to connect to this service and even ping it from my pods in the cluster .Need help as to what am i doing wrong.I am using the kubernetes that comes shipped with docker-desktop-for-windows

ExternalName service yaml

apiVersion: v1
kind: Service
metadata:
  name: dbservice
spec:
  type: ExternalName
  externalName: geekdude9094  //my hostname

results when bin bashing into one of the pods and pinging the service

   root@service-app-6ffb5c88fb-5kvcd:/usr/local/tomcat#  ping dbservice
    PING geekdude9094.home (192.168.10.22): 56 data bytes
    92 bytes from broadcom.home (192.168.10.1): Destination Host Unreachable
    92 bytes from csp3.zte.com.cn.home (192.168.10.1): Destination Host Unreachable
    92 bytes from broadcom.home (192.168.10.1): Destination Host Unreachable
    92 bytes from csp3.zte.com.cn.home (192.168.10.1): Destination Host Unreachable
    92 bytes from broadcom.home (192.168.10.1): Destination Host Unreachable
    92 bytes from csp3.zte.com.cn.home (192.168.10.1): Destination Host Unreachable
    92 bytes from broadcom.home (192.168.10.1): Destination Host Unreachable
    92 bytes from csp3.zte.com.cn.home (192.168.10.1): Destination Host Unreachable
    ^C--- geekdude9094.home ping statistics ---

My windows OS: windows 10 64 bit
kubernetes version: 1.10.11 both client and server
-- JayD
docker-desktop
kubernetes

1 Answer

11/29/2019

I think the reason you can't access the service is that docker-desktop-for-windows run a virtual machine with different networking layers. So from point of networking the cluster cloudn't reach this 192.168.10.1 network because as far as I know, docker windows virtual machine use 10.0.75.0 subnet address. Maybe you can use this option

-- Alireza Davoodi
Source: StackOverflow