fix(k8s): use NodePort with externalTrafficPolicy Local to preserve client IP
Some checks failed
Build and Deploy / build (push) Has been cancelled
Some checks failed
Build and Deploy / build (push) Has been cancelled
Change storefront service from ClusterIP to NodePort with externalTrafficPolicy: Local. This preserves the real client source IP instead of NATing to the node IP. Fixes analytics tracking showing Hetzner IP (138.201.11.251) instead of real visitor IPs. Same fix previously applied to Rybbit backend service. Note: On single-node clusters, this works seamlessly. Traefik routes directly to the node where the pod is running, preserving the original source IP.
This commit is contained in:
@@ -4,9 +4,13 @@ metadata:
|
|||||||
name: storefront
|
name: storefront
|
||||||
namespace: manoonoils
|
namespace: manoonoils
|
||||||
spec:
|
spec:
|
||||||
|
# Use NodePort with externalTrafficPolicy: Local to preserve client source IP
|
||||||
|
# This is required for proper client IP detection in analytics (Rybbit, etc.)
|
||||||
|
type: NodePort
|
||||||
|
externalTrafficPolicy: Local
|
||||||
selector:
|
selector:
|
||||||
app: storefront
|
app: storefront
|
||||||
ports:
|
ports:
|
||||||
- port: 3000
|
- port: 3000
|
||||||
targetPort: 3000
|
targetPort: 3000
|
||||||
type: ClusterIP
|
# Let Kubernetes assign a NodePort automatically
|
||||||
|
|||||||
Reference in New Issue
Block a user