There is a web service app running on a Compute Engine and a GKE cluster in the same network.
Is it possible for a pod in the cluster to call the web service app using internal IP address of web service app?
Your answer will be appreciated.
Thanks.
There is a web service app running on a Compute Engine and a GKE cluster in the same network.
Is it possible for a pod in the cluster to call the web service app using internal IP address of web service app?
Your answer will be appreciated.
Thanks.
TL;DR
Yes it's possible.
Assuming that you are talking about the Internal IP address of your
VMyou will need to create a rule allowing traffic frompod address rangeto yourVM.Example
Assuming that:
Compute Engineinstance named:nginxand it's configured to run on port80.Kubernetes Enginewithin the same network as yourGCEinstance.You will need to check the pod ip address range of your
GKEcluster. You can do it by either:Cloud Console(Web UI)$ gcloud container clusters describe CLUSTER-NAME --zone=ZONE | grep -i "clusterIpv4Cidr"The firewall rule could be created by either:
Cloud Console(Web UI)gcloudcommand like below:After that you can spawn a pod and check if you can communicate with your
VM:$ kubectl run -it ubuntu --image=ubuntu -- /bin/bash$ apt update && apt install -y curl dnsutilsYou can communicate with your
VMwithGKEpods by either:VM:VM(nginx):You can also check if the name is correctly resolved by running:
Additional resources: