Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect from Appengine to a Kubernetes service from Google Containers

I have a project with Appengine part and Google Containers cluster. Appengine app needs to make http calls to a Service deployed to Google Containers.

I know that I can assign an external IP to the Service, hardcode it into my Appengine app, and then make UrlFetch requests agains such IP. That works. But I don't want to use public network for such communication.

I wondering maybe I can also get access like it's done inside Kubernetes cluster between Pods? by specifying a service host name, that resolves to an internal IP in 10.x.x.x range.

Is it possible to do same from Appengine? is there a special naming schema resolvable to GKE services?

like image 428
Igor Artamonov Avatar asked Jan 12 '16 15:01

Igor Artamonov


People also ask

How do I access Kubernetes service from outside?

Ways to connect You have several options for connecting to nodes, pods and services from outside the cluster: Access services through public IPs. Use a service with type NodePort or LoadBalancer to make the service reachable outside the cluster. See the services and kubectl expose documentation.

How do I access a service in Kubernetes?

In case you want to access an external service, you need to: create a Service without any selector - Kubernetes will NOT create an Endpoints object. manually create the Endpoints resource corresponding to your Service (with the same name) and IP/port of the service you want to access.

Does Google use Kubernetes or Borg?

Kubernetes builds on 15 years of running Google's containerized workloads and the valuable contributions from the open source community. Inspired by Google's internal cluster management system, Borg, Kubernetes makes everything associated with deploying and managing your application easier.


1 Answers

There isn't currently a way to inject packets from an App Engine application into the private GCP network where your Kubernetes cluster is running (e.g. coming from a 10.0.0.0/8 address). So the only way to connect your application to your Container Engine service is to use the external IPs (as you are currently doing).

like image 88
Robert Bailey Avatar answered Oct 05 '22 09:10

Robert Bailey