Pod communication in GKE cluster

k8scale.io
k8scaleio-engineering
2 min readFeb 9, 2020

--

In this article we will talk about how you can communicate between services running in the same cluster.

We will take example of a cluster running in Google Kubernetes engine (GKE)

When you host a service in GKE and you expose through a domain name then you can access it by accessing the domain endpoint.

An example would be http://api.example.com or something like that.

An example diagram for this traffic path is shown below

There are multiple reasons when you want the traffic not to go out to internet and you want to access your services with in the pod.

An example would be Pod B calling a service running in Pod A. The call is shown by bold green line.

You need to expose the pod through an internal node-port service. Follow one of our previous blog on this: https://medium.com/k8scaleio/running-spring-boot-application-on-gke-480b50bded06

Or you can follow the google official documentation here:

Once you have service running you can run command

kubectl get services this would give all the services for the cluster.

You can now use the Cluster IP and the port information to connect to the service.

http://<CLUSTER-IP>:<PORT>

--

--