No1Lives4Ever
No1Lives4Ever

Reputation: 6903

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?

Upvotes: 3

Views: 5253

Answers (2)

Nitin Kumar Singh
Nitin Kumar Singh

Reputation: 322

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.

Upvotes: 2

netskink
netskink

Reputation: 4539

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.

Upvotes: 0

Related Questions