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
VM
you will need to create a rule allowing traffic frompod address range
to yourVM
.Example
Assuming that:
Compute Engine
instance named:nginx
and it's configured to run on port80
.Kubernetes Engine
within the same network as yourGCE
instance.You will need to check the pod ip address range of your
GKE
cluster. 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)gcloud
command 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 dnsutils
You can communicate with your
VM
withGKE
pods by either:VM
:VM
(nginx
):You can also check if the name is correctly resolved by running:
Additional resources: