Google Cloud Kuberneties: Finding the external IP address for pods

7/22/2018

I have deployed a Kubernetes cluster to GCP. For this cluster, I added some deployments. Those deployments are using external resources that protected with security policy to reject connection from unallow IP address.

So, in order to pod to connect the external resource, I need manually allow the node (who hosting the pod) IP address.

It's also possible to me to allow range of IP address, where one of my nodes are expected to be running.

Untill now, I just find their internal IP addresses range. It looks like this:

Pod address range 10.16.0.0/14

The question is how to find the range of external IP addresses for my nodes?

-- No1Lives4Ever
google-cloud-platform
kubernetes

2 Answers

7/22/2018

Let's begin with the IPs that are assigned to Nodes:

  • When we create a Kubernetes cluster, GCP in the backend creates compute engines machines with a specific internal and external IP address.
  • In your case, just go to the compute engine section of the Google Cloud Console and capture all the external IPs of the VM whose initials starts with gke-(*) and whitelist it.
  • Talking about the range, as such in GCP only the internal IP ranges are known and external IP address are randomly assigned from a pool of IPs hence you need to whitelist it one at a time.

To get the pod description and IPs run kubectl describe pods.

-- Nitin Kumar Singh
Source: StackOverflow

7/23/2018

If you go to the compute engine instance page it shows the instances which make the cluster. it shows the external ips on the right side. For the the ip of the actual pods use the Kubectl command.

-- netskink
Source: StackOverflow