Score:0

Assigning different external IP for each Pod on GKE autopilot

cn flag

I am in the process of moving our project from the Compute Engine to GKE autopilot (cost efficiency, scale-up/down).

Currently, in the Compute Engine, each machine gets a different external IP (at no cost, by default, I don't care about reserving IPs, incoming traffic).

I just care that the target/destination the machines requesting data from, will see they are from different IPs

How can I make each Pod come up with a different external IP (as in the GCE)? With no extra/minimal cost? Is it possible?

Pit avatar
dz flag
Pit
Have you checked the documentation related to [rotate your control plane IP](https://cloud.google.com/kubernetes-engine/docs/how-to/ip-rotation)? Unsure if this will renew pods IP addresses.
SpazaM avatar
cn flag
Actually, correct me if I'm wrong but as I dig deeper in k8s, I understand that Pod never will have an external IP, they must have Service (to serve IP to the outer world), But I'm not sure if it's legit to create 1 pod with 1 service, lets say 12, or 15.
Gari Singh avatar
cn flag
Do you really need each pod to appear to come from a different IP? Or is it ok is all pods on a given node come from the same IP?
SpazaM avatar
cn flag
I am really need each pod to appear to come from different IP
Gari Singh avatar
cn flag
Ok, so then why exactly do you need them to appear to come from different IPs? Just trying to understand the use case to see if there may be an alternative which still meets the core requirements.
Score:1
ng flag

Each Pod has a single IP address assigned from the Pod CIDR range of its node. This IP address is shared by all containers running within the Pod, and connects them to other Pods running in the cluster.Pod IP address is ephemeral(lasts for a very short time) and even External IP Services are not permitted on Autopilot clusters. To give a Service an external IP, you can use a LoadBalancer type of Service or use an Ingress to add the Service to an external IP shared among several services.

Traditionally, HTTP(S) load balancers targeting Kubernetes clusters would actually be targeting its nodes because they didn’t have a way to recognize each pod. But Google came out with a Network Endpoint Group (NEG) abstraction layer that enables container-native load balancing. This means the load balancer has visibility into a Kubernetes cluster’s pods because NEGs are integrated with the Kubernetes Ingress controller running on GCP. If they have a multi-tiered e-commerce deployment and want to expose one service to the internet using GKE. With NEGs they can now provision an HTTP(S) load balancer, allowing them to configure path-based or host-based routing to their backend pods.

There is no charge for ingress traffic. However there may be a charge for load balancer that processes ingress traffic. Refer this documentation for pricing details of Load balancers enter image description here

SpazaM avatar
cn flag
Hi, thanks for the details and long answer. I just want to make sure you got my question right, my initial and final purpose is that the **destination** that the Pods requesting, will think they are different machines from different addresses. Therfore I need that each Pod will have different IP externally (without any care about reserving IPs, incoming requests), I care only about the destination to think they come from different IP addresses. That's why I started with GCE, and thought that GKE can save me cost, but now I'm not sure K8s can offer that kind of a solution.
Goli Nikitha avatar
ng flag
@SpazaM, yeah I got your question and my solution for that is as there is no provision of external IP address for pods so using load balancer type service which can externally host an IP address and internally forward the request to pods on our routing rules and load balancer is one of the best options to distribute the traffic evenly among the pods. If you directly want to have an external IP of the pod to be used that is not possible .
SpazaM avatar
cn flag
Thanks for the response, I just wanted the Pods to be seen at the destination service, as different IP addresses (when they initiate a request), I guess it's not possible with K8s...
Goli Nikitha avatar
ng flag
@SpazaM, yes its not possible.
Goli Nikitha avatar
ng flag
@SpazaM, If the answer was useful, please mark the answer as accepted for greater visibility for community or upvote if the answer has some useful information.
SpazaM avatar
cn flag
Upvoted, thanks.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.