2

I have multiple different pods (containers) (9) on gcloud using kubenetes each with their own static IP address. I also have multiple node pools (9) in the cluster they all use. If I make a cURL request from any of the pods (containers) the IP address that is logged in the destination URL's logs is always the IP address of the first node pool in the cluster.

My question is does this consistently happen? If this node pool is removed I lose the IP address. Is there any way to make this cURL request address static?

I need this because these containers need to cURL an external service that is IP limited and I need to make a request to change this IP address each time it changes.

Dan Cornilescu
  • 39,470
  • 12
  • 57
  • 97
Apothan
  • 187
  • 1
  • 2
  • 9

1 Answers1

1

Since you have a large number of nodes, I think the only reliable way to do this would be to configure a single node as the NAT gateway for the outbound traffic. So outbound traffic from all nodes will first go to the NAT gateway which in turn will connect to your external service. You can then assign a static IP to this gateway VM instance. Obviously this also introduces a single point of failure for external traffic.

This page contains detailed steps on setting up a NAT gateway. You may also refer to this discussion.

A second option would be to have a dedicated pool/nodes just for pods which needs external access. You can then give dedicated IPs for those nodes alone.

Jayson Chacko
  • 2,388
  • 1
  • 11
  • 16
  • The NAT gateway might be the only solution as of now but has it's drawbacks. It seems the GKE team is aware of this missing functionality. With regards to your comment to assign dedicated IPs to the nodes I am not aware how to do this. I am able to assign dedicated IPs to pods but not nodes. If you are aware how to do this then this could be a solution. – Apothan Sep 21 '17 at 14:14
  • From cloud dashboard, click on "VPC Network" and then "External IP Addresses". From here you can give static IP addresses to your nodes. These IP addresses will be visible to the external service when you make an API call. – Jayson Chacko Sep 22 '17 at 04:23
  • OK I see how. This https://stackoverflow.com/questions/41133755/static-outgoing-ip-in-kubernetes also helped. – Apothan Sep 22 '17 at 17:24