Problem statement:
If you run your Webite or eCommerce Platform on Kubernetes, you might experience problems with geolocating the addresses of your visitors and potential customers.
A potential cause for this issue is, that you have exposed your app through a service of type: LoadBalancer and your Kubernetes Container cannot see the original source IP addresses of the visitors.
Solution:
This solution describes how to preserve client IP addresses on Google Kubernetes Engine (GKE) for services of type: LoadBalancer.
Note: This is especially required if you need to geolocate visitor addresses e.g. in order to display correct taxes (like done by GT4M – Global Tax for Marketplace and More).
Set the externalTrafficPolicy to Local in your Service configuration as follows:
apiVersion: v1
kind: Service
metadata:
name: <yourapp-service>
spec:
selector:
app: <yourapp>
ports:
- port: <port>
targetPort: <targetport>
externalTrafficPolicy: Local
type: LoadBalancer
That’s all 🙂
Need further support or Kubernetes Consulting?
Please checkout our Consulting hours.
You don’t want to go into technical details anymore?
Check out the Blue Antoinette Commerce Cloud, which is built on and abstracts away the complexities of Kubernetes.
–