<p>I have a web scraping app that is deployed on a kubernetes cluster on GCP and this app uses a proxy to connect to multiple browsers. So I need to assign a static ip address so that the proxy can do its job, but the problem here is that I can't figure out which address to give to the proxy server. I tried to give the ingress and egress static address but it always shows &quot;Connection refused with the proxy&quot; error.</p>
<p>PS: The proxy works like magic on my local machine as I'm using a dns server to fix the dynamic IP addresses situation.</p>
<p>How should I do the same when the environment is actually on GKE.</p>

Dawn tns
<p>As your traffic comes into the cluster from single point you should be diverting the traffic from single point also which is Egress point.</p>
<p>I am not sure what you mean when you say egress but it will be Node IP mostly if you are running GKE default.</p>
<p>Kubernetes uses the Node IP as outgoing IP on which POD is scheduled.</p>
<p>I would suggest setting up <strong>NAT</strong> <strong>gateway</strong> in front of the <strong>GKE</strong> cluster. So all your traffic goes from a single point and you can Whitelist this IP into your Proxy and it will work.</p>
<p>Now if you are not much into GKE and NAT set up just this Terraform which will do all the work for you. Terraform will set up the NAT gateway.</p>
<p>Terraform NAT GKE : <a href="https://registry.terraform.io/modules/GoogleCloudPlatform/nat-gateway/google/latest/examples/gke-nat-gateway" rel="nofollow noreferrer">https://registry.terraform.io/modules/GoogleCloudPlatform/nat-gateway/google/latest/examples/gke-nat-gateway</a></p>
<p>Github Repo : <a href="https://github.com/GoogleCloudPlatform/terraform-google-nat-gateway/tree/v1.2.3" rel="nofollow noreferrer">https://github.com/GoogleCloudPlatform/terraform-google-nat-gateway/tree/v1.2.3</a></p>
<p><a href="https://i.stack.imgur.com/yvwbe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yvwbe.png" alt="enter image description here" /></a></p>
