Open NoeSamaille opened 1 year ago
Found the issue, so the service IP range of my cluster is 10.43.0.0/16
and my Pod IP range is 10.42.0.0/16
, however only the later is specifically mentioned in my Pod routing table:
$ ip route
default via 10.42.1.1 dev eth0
10.42.0.0/16 via 10.42.1.1 dev eth0
10.42.1.0/24 dev eth0 proto kernel scope link src 10.42.1.24
It means that when the client_init.sh
script deletes the existing default gateway the pod isn't able to access the DNS server any longer.
To fix that as a workaround I have manually configured my routed deployment as follow with a gateway-preinit
initContainer that adds 10.43.0.0/16
:
...
initContainers:
- command: ["/bin/sh","-c"]
args: ["ip route add 10.43.0.0/16 via 10.42.1.1 dev eth0"]
image: ghcr.io/angelnu/pod-gateway:v1.8.1
imagePullPolicy: IfNotPresent
name: gateway-preinit
resources: {}
securityContext:
capabilities:
add:
- NET_ADMIN
- NET_RAW
runAsNonRoot: false
runAsUser: 0
That way after default gateway deletion it's still able to reach the services IP range and therefore the K8s internal DNS server.
@angelnu I'm sure there is a way to have a clean fix by slightly updating the client_init.sh
script e.g. by adding that routeip route add ${K8S_DNS_IP}/16 via ${K8S_DEFAULT_GW} dev eth0
before removing default GW, happy to discuss/contribute.
I'm not sure if it's due to my K8s topology which is pretty standard: K3s running K8s v1.26 with default Flannel CNI.
Don't have you exact setup but have you looked at using NOT_ROUTED_TO_GATEWAY_CIDRS, these values are put in the ip route as you outline so may help.
Details
What steps did you take and what happened:
Hi there! I have tried to deploy the pod gateway and admission controller using your Helm chart, using the following values:
So far so good, I've got the pod gateway and admission controller up and running in my
vpn-gateway
ns with wireguard VPN client working on the pod gateway, now trying to actually route a pod in mymedia-center
routed ns:These are the logs of the
gateway-init
container of mytransmission-client
pod:It looks like it's not able to resolve
vpn-gateway-pod-gateway.vpn-gateway.svc.cluster.local
in the init container, but the cluster local DNS works fine I tried running the same pod in a non routed namespace, exec into it andnslookup
and it worked fine:Any idea what can cause this behavior?
What did you expect to happen:
I was expecting the routed pod gateway to be updated successfully with the pod starting up.
Anything else you would like to add:
Any help appreciated, there is probably something I'm missing here, happy to provide more information to debug this, thanks :)