Home > Mobile >  What ip address did my app use when acces 3rd party API?
What ip address did my app use when acces 3rd party API?

Time:02-23

I'm using GKE to manage my app and the app is trying to consume 3rd party API, and the 3rd party API is whitelisting ip addresses that trying to access their APIs, how can i find what ip address that my app used when consume 3rd party APIs?

CodePudding user response:

The IP address used by the Pod depends on type of service and a few more factors, which are very well documented in this documentation page

There is also IP Masquerade agent which allows you to use Node's IP address to talk to services on other nodes instead of IP of POD, documented here

Now coming to solution to your actual problem, you will have to use a NAT Gateway tied to a static IP so that all the outgoing traffic from your cluster will use same IP - no matter which POD/Node it originates from. I found a few guide but YMMV based on which cloud or underlying infrastructure you are on

You should search for "Kubernetes IP Masquerade NAT " for instructions specific to your cloud!

CodePudding user response:

If you are using the GKE public cluster it will the Node's IP on which POD is running mostly, however in some cases it could be different like Private cluster and using NAT instaces.

If your cluster is public and has multiple Nodes in cluster and different pod giving different IP which means POD's using Node's IP as out bound.

You can exec into POD and check using curl inside of POD

kubectl exec -it <POD name > -- /bin/sh

and run

curl ifconfig.me
  • Related