Trying to run on kind NodePort. Cannot find GW_IP #858
Replies: 3 comments
-
hi @agardnerIT Thanks for the detailed report. I see a number of things we can improve. Let me know your thoughts (1)
The mentioned I don't think it makes sense to do enable port mapping by default, because this will can lead to conflicts with other apps that can map those ports or NKG replicas. However, we're bringing the helm chart support https://github.com/nginxinc/nginx-kubernetes-gateway/pulls and we can add enabling port-mapping as an option. Once it is there, there will be no need to port-forward in your case. Additionally, it is possible to update https://github.com/nginxinc/nginx-kubernetes-gateway/blob/4923dd98468a6881ecabc3be94af946ca43727a6/deploy/manifests/deployment.yaml#L62-L66 before deploying NKG, to enable port mapping now: ports:
- name: http
containerPort: 80
hostPort: 80
- name: https
containerPort: 443
hostPort: 443 (2)
Would it help if we? (3) By default, NKG sets the IP of the pod to the Status of the Gateway resource, as a way to signal what IP(s) to use to send traffic:
When NKG exposed via Service, that pod IP is not that helpful, because external clients will not use it to send traffic to NKG. We have an issue for that #604 P.S. spec:
gatewayClassName: nginx
listeners:
- name: http
port: 8080
protocol: HTTP
hostname: "*.example.com" |
Beta Was this translation helpful? Give feedback.
-
note: Converted the issue to a discussion. If enhancements come out of it, we can add them as issues. This follows https://github.com/nginxinc/nginx-kubernetes-gateway/blob/main/CONTRIBUTING.md#issues-and-discussions |
Beta Was this translation helpful? Give feedback.
-
Thanks for your fast response! Allow me a few days to digest and experiment with this and I'll get back to you |
Beta Was this translation helpful? Give feedback.
-
I'm trying to test this out on kind on WSL2 windows localhost. Everything (seems to) work until I need the
GW_IP
and I can't find it.TLDR: I got it working with port-forward AND gateway - but (and this is probably my lack of k8s knowledge) but I don't understand why I need port forward AND gateway. I don't need port forward with an nginx ingress and I thought gateway replaced ingress?
Here's what I'm doing:
Where
config.yaml
:Note: I don't think that
kubeadmConfigPatches
block is necessary - it is just left over from a different cluster - but I don't think it will affect anything in this demo.Then I follow the instructions exposing as a
NodePort
.As I say, everything appears to go fine.
Then I jump into the cafe example.
First thing it asks me to do is save
GW_IP
into a variable - but doesn't explain how I retrieve that value.Then it asks to save
GW_PORT
- again with no indication of where I retrieve that value - but I assume it's80
?Any pointers or assistance you can provide would be great!
Happy to raise PRs if we identify docs improvements.
Debugging
Got it working inside cluster
This command shows an IP address of
10.244.0.8
so changing gateway:hostname: "10.244.0.8.nip.io"
and gateway hosts to the same value, I can at least get to the endpoints from within the cluster:Working Config
NodePort
servicekubectl -n nginx-gateway port-forward 80:80 443:443 svc/nginx-gateway
127.0.0.1.nip.io
curl http://127.0.0.1.nip.io/tea
andcurl http://127.0.0.1.nip.io/coffee
worksBut I have NO idea why I need port-forward AND a gateway. It seems to partially defeat the purpose. I don't need to port forward with an nginx ingress - and I thought gateway was a replacement?
Beta Was this translation helpful? Give feedback.
All reactions