Hello all,!
I am currently studying API Gateway and chose nginx fabric as implementation and k0s as my kubernetes runtime.
I am trying a simple “local” configuration and everything looks good except for the gateway not finding my sample service.
I’ve documented everything i did so far in this discussion here: k0s cluster - unable to connect with service · nginxinc/nginx-gateway-fabric · Discussion #1357 · GitHub
Any guidance is welcome, i’ll try another Gateway API implementation to see if it’s nginx fault, but i appreciate any extra hint on this.
for anyone wondering the outcome of this, i ended up using ingres, way more simpler to configure for now NGINX Ingress Controller - Documentation
i just applied the manifest and done, i was able to deploy a sample application with near zero effort.
i gues i must wait for gateway api solutions to get simpler to use, at least with k0s
Yeah, Ingress is much simpler, but naturally comes with some limitations. Which to solve GatewayAPI was developed.
As your Ingress works, meaning the ingress controller can connect to the pods, it seems the pod networking is working fine. Why is the Nginx GW thingy not able to connect to the svc/pod, I have no idea. I’d check few things:
- Exec into the GW pod(s) and try if you can connect to the svc/pod IPs directly
- If the GW pods do not come with any additional tooling,
kubectl debug ...
is very handy
- Can you see any requests to the target pod, check the logs?
1 Like
Hey, thanks for the reply!
well, one thing i did different this time was to disable firewalld, at least while i thest this.
now i got nginx response with bad gateway but no luck serving the httproutes.
this is what i tried so far: GitHub - sombriks/k0s-api-gw-issue: for some reason use api gw instead of ingress is not working when using nginx fabric on k0s
That worked for me, although I had to change the image used in the deployment as my test setup was running on arm64 and the image you used has only amd64 arch available.
root@gw-test:/# k0s kc get deployment,pod,svc,httproute
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/simple-deployment 2/2 2 2 17m
NAME READY STATUS RESTARTS AGE
pod/simple-deployment-79dc686cfc-rmnzp 1/1 Running 0 6m40s
pod/simple-deployment-79dc686cfc-8q7gw 1/1 Running 0 6m34s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 22m
service/simple-service ClusterIP 10.102.225.32 <none> 8080/TCP 18m
NAME HOSTNAMES AGE
httproute.gateway.networking.k8s.io/simple-route 18m
root@gw-test:/# k0s kc -n nginx-gateway get deployment,svc
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/nginx-gateway 1/1 1 1 19m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/nginx-gateway NodePort 10.97.192.2 <none> 80:31910/TCP,443:31339/TCP 18m
root@gw-test:/# curl 10.97.192.2
Request served by simple-deployment-79dc686cfc-rmnzp
GET / HTTP/1.1
Host: 10.97.192.2
Accept: */*
Connection: close
User-Agent: curl/7.81.0
X-Forwarded-For: 10.244.0.1
root@gw-test:/# curl localhost:31910
Request served by simple-deployment-79dc686cfc-8q7gw
GET / HTTP/1.1
Host: localhost:31910
Accept: */*
Connection: close
User-Agent: curl/7.81.0
X-Forwarded-For: 10.244.0.1