How to access service in google container engine from google compute engine instance

10/1/2016

I have a cluster on a google container engine. There are internal service with the domain app.superproject with exposed port 9999.

Also I have an instance in google compute engine.

How can I access to service with it's domain name from the instance of google compute engine?

-- Mark Pegasov
google-cloud-platform
google-compute-engine
google-kubernetes-engine

1 Answer

10/1/2016

GKE is built on top of GCE, a GKE instance is also a GCE instance. You can view all your instances either in the web console, or with gcloud compute instances list command.

Note that they may not be in the same GCE virtual network, but in your use case, it's better to put them in, e.g., the default network (I guess they are already, but check their network properties if you are not sure), then they're accessible to each other through the internal IPs (if not, check firewall settings).

You can also use instance names, which resolve to internal IPs, e.g., ping instance1.

If they're not in the same GCE virtual network, you have to treat the service as an external service by exposing an external IP, which is not recommended in your use case.

-- Dagang
Source: StackOverflow