<p>We are in the process of move all our services over to Docker hosted on Google Container Engine. In the mean time we have have some services in docker and some not.</p>

<p>Within Kubernetes services discovery is easy via DNS, but how do I resolve services from outside my container cluster? ie, How do I connect from a Google Compute Engine instance to a service running in Kubernetes?</p>

<p>The solution I have for now is to use the service clusterIP address.</p>
<p>You can see this IP address by executing <code>kubectl get svc</code>. This ip address is by default not static, but you can assign it when defining you service.</p>
<p>From the documentation:</p>
<blockquote>
<p>You can specify your own cluster IP address as part of a Service creation request. To do this, set the spec.clusterIP</p>
</blockquote>
<p>The services are accessed outside the cluster via IP address instead of DNS name.</p>
<h3>Update</h3>
<p>After deploying another cluster the above solution did not work. It turns out that the new IP range could not be reached and that you do need to add a network route.</p>
<p>You can get the cluster IP range by running
<code>$ gcloud container clusters describe CLUSTER NAME --zone ZONE</code></p>
<p>In the output the ip range is shown with the key <code>clusterIpv4Cidr</code>, in my case it was <code>10.32.0.0/14</code>.</p>
<p>Then create a route for that ip range that points to one of the nodes in your cluster. <code>$ gcloud compute routes create --destination-range 10.32.0.0/14 --next-hop-instance NODE0 INSTANCE NAME</code></p>
