Kubernetes changes three things about the call from your server: where the API key lives, how the visitor's address survives the load balancer and the gateway, and whether the pod may reach korzen.dev at all. The call itself is your framework's: take it from the guide for your stack.
The key
Keep the API key in a Secret, never in the image or a ConfigMap, and hand it to the container as an environment variable:
kubectl create secret generic korzen --from-literal=api-key=kz_ak_your_key
# deployment.yaml, in your app's container env: - name: KORZEN_API_KEY valueFrom: secretKeyRef: name: korzen key: api-key
The visitor's IP
By default a cloud load balancer hides the visitor behind its own address. ingress-nginx is retired upstream: it gets no releases or security fixes after March 2026 (Kubernetes' announcement). The Gateway API takes its place; the settings below are Envoy Gateway's, from the CNCF's Envoy project. The Service it makes for a Gateway keeps the visitor's address (externalTrafficPolicy: Local is its default), and Envoy adds the address it sees to the end of X-Forwarded-For: your application reads that last entry (ip_from: last_forwarded); behind Cloudflare, CF-Connecting-IP.
# gateway.yaml: an Envoy Gateway in front of your app. Its Service keeps the visitor's # address: externalTrafficPolicy is Local unless an EnvoyProxy sets it otherwise. apiVersion: gateway.networking.k8s.io/v1 kind: Gateway metadata: name: web spec: gatewayClassName: eg # the GatewayClass of your Envoy Gateway install listeners: - name: http protocol: HTTP port: 80
# Only if your cloud's load balancer speaks PROXY protocol, turned on there too: # Envoy then takes the visitor's address from it, and adds that to X-Forwarded-For. apiVersion: gateway.envoyproxy.io/v1alpha1 kind: ClientTrafficPolicy metadata: name: web-proxy-protocol spec: targetRefs: - group: gateway.networking.k8s.io kind: Gateway name: web proxyProtocol: {}
Egress
If the cluster blocks traffic out of a namespace by default, the pod must be allowed to reach port 443:
# Only if your cluster blocks egress by default: let the app reach HTTPS. # A plain NetworkPolicy matches addresses, not names, and korzen.dev answers from # Cloudflare's ranges; with Cilium, an FQDN rule can name korzen.dev itself. apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: app-egress-https spec: podSelector: matchLabels: app: shop policyTypes: [Egress] egress: - ports: - port: 443 protocol: TCP - ports: - port: 53 protocol: UDP
Running it
- One HTTP client per pod, kept open; every replica opens its own connection, which is fine.
- Never make a readiness or liveness probe depend on Bot Protection: when it is slow, the pods must stay in service and fail open.
- Your SDK's timeout counts from where the cluster runs: a cluster in the US west needs about 300 ms.
Common mistakes
- The gateway's own address sent as the visitor's: every decision then shares one IP, and Bot Protection sees one very busy visitor.
- The first
X-Forwarded-Forentry read as the visitor's: the visitor writes it and picks their address. The last entry is the one Envoy saw. - The key in a ConfigMap or baked into the image, where anyone with read access to the namespace or the registry sees it.