lb-ip-binder: use KUBERNETES_SERVICE_{HOST,PORT} env vars

hostNetwork pods don't go through CoreDNS by default, so the
kubernetes.default.svc hostname doesn't resolve and the reconcile
loop silently failed on the curl. The auto-injected
KUBERNETES_SERVICE_HOST/PORT env vars give the apiserver Service
IP+port directly — Cilium kpr DNATs the ClusterIP to a live
apiserver endpoint.
This commit is contained in:
2026-05-20 17:43:29 +02:00
parent 6b4610d513
commit c7d652477b
@@ -58,7 +58,11 @@ data:
set -u
TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
CA=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt
API=https://kubernetes.default.svc
# hostNetwork pods don't use CoreDNS by default, so the
# kubernetes.default.svc hostname doesn't resolve. Use the
# auto-injected env vars instead — they hold the apiserver Service
# IP+port that Cilium's kpr DNATs to a real apiserver endpoint.
API="https://${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT}"
# Ensure dummy0 exists and is up. Cilium creates it on startup but
# we don't depend on that.