Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Cloud Kuberneties: Finding the external IP address for pods

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?

like image 229
No1Lives4Ever Avatar asked Nov 22 '25 13:11

No1Lives4Ever


1 Answers

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.

like image 111
Nitin Kumar Singh Avatar answered Nov 24 '25 09:11

Nitin Kumar Singh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!