https://rancher.com/ logo
m

miniature-advantage-69986

10/28/2022, 11:07 AM
Problem when using domain names such as "grafana.monitoring.localhost" not being routed to Ingress-controller with RD 1.6.1 All Domains ending with "*.localhost" are interpreted as 127.0.0.1 which is very convenient for testing services in K8S as it is not necessary to have a DNS Server for all services. Until RD 1.6.0 this really worked well but something seems to have changed. Are others having the same problems?
f

fast-garage-66093

10/28/2022, 3:37 PM
Is this on Linux? I don't think the
*.localhost
name resolution works on any other platform and is just a
systemd-resolved
feature.
m

miniature-advantage-69986

10/28/2022, 7:14 PM
Sorry, i forgot to mension that this is on Windows. Chrome and even curl act as i wrote.
f

fast-garage-66093

10/28/2022, 7:50 PM
I don't have a Windows 11 machine here, but it doesn't work on Windows 10. Neither the PowerShell scriptlet nor the regular
curl.exe
seem to do it:
Copy code
PS C:\Users\Jan> curl <http://foo.localhost>
curl : The remote name could not be resolved: 'foo.localhost'
At line:1 char:1
+ curl <http://foo.localhost>
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
   eption
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

C:\Users\Jan>curl <http://foo.localhost>
curl: (6) Could not resolve host: foo.localhost
I know it works for Chrome because it is built into the browser and doesn't use the host to resolve it.
m

miniature-advantage-69986

10/28/2022, 7:54 PM
But even using curl http://127.0.0.1 is not forwarded to the ingress-controller und it was prior to RD 1.6.0
f

fast-garage-66093

10/28/2022, 7:56 PM
I'm pretty sure that worked for me with 1.6.1 (and 1.6.0); let me try again. Are you sure you are using
127.0.0.1
and not
localhost
. The latter is often resolved to
[::1]
on Windows, and RD is not currently reachable over IPv6
Works for me on Windows 10:
Copy code
C:\Users\Jan>kubectl get no
NAME              STATUS   ROLES                  AGE   VERSION
desktop-4992680   Ready    control-plane,master   97d   v1.23.8+k3s2

C:\Users\Jan>curl <http://127.0.0.1>
404 page not found

C:\Users\Jan>curl <http://localhost>
404 page not found
Copy code
C:\Users\Jan>kubectl get svc -n kube-system traefik
NAME      TYPE           CLUSTER-IP    EXTERNAL-IP       PORT(S)                      AGE
traefik   LoadBalancer   10.43.24.34   192.168.194.136   80:31257/TCP,443:32638/TCP   97d
The
404 page not found
comes from traefik, so name resolution and routing seems to be working fine (even for
localhost
)
This is all with 1.6.1
r

rich-airport-82798

10/31/2022, 12:16 PM
Thanks @fast-garage-66093, i also did a positive test on my private notebook. Will check to see what the problem is on my business notebook. Sorry for the inconvinience!
f

fast-garage-66093

10/31/2022, 4:06 PM
Please let me know if there is a way to let Windows resolve
*.localhost
addresses at the system level; that would be very useful, if it can be made to work consistently
m

miniature-advantage-69986

11/01/2022, 5:44 AM
I must admit that i'm not using "C:\Windows\System32\curl.exe" but have downloaded curl from https://curl.se/windows/ where Daniel Stenberg made the changes for making the resolve work for *.localhost in version 7.85.1 (see: https://daniel.haxx.se/blog/2021/05/31/curl-localhost-as-a-local-host/). I hope that his changes will be ported to Microsofts version (7.83.1 on my machine) some day.
kubectl get svc -n kube-system traefik
Copy code
NAME      TYPE           CLUSTER-IP     EXTERNAL-IP    PORT(S)                      AGE
traefik   LoadBalancer   10.43.143.44   172.27.9.226   80:30053/TCP,443:32490/TCP   153d
Besides this 127.0.0.1 is not being forwarded to the ingress-controller 172.27.9.226.
curl -v <http://grafana.monitoring.localhost>
Copy code
*   Trying 127.0.0.1:80...
*   Trying [::1]:80...
* connect to 127.0.0.1 port 80 failed: Connection refused
* connect to ::1 port 80 failed: Connection refused
* Failed to connect to grafana.monitoring.localhost port 80 after 2254 ms: Couldn't connect to server
* Closing connection 0
curl: (7) Failed to connect to grafana.monitoring.localhost port 80 after 2254 ms: Couldn't connect to server
f

fast-garage-66093

11/01/2022, 6:04 AM
Thank you for pointing out that the latest
curl
releases have implemented this internally (it is not the change mentioned in the blog post though, which only resolves plain
localhost
internally. It is curl does not automatically resolve `*.localhost` like Chrome does. · Issue #9192 · curl/curl that implements the subdomain feature already implemented in Chrome and Firefox, but not Safari).
m

miniature-advantage-69986

11/01/2022, 6:07 AM
f

fast-garage-66093

11/01/2022, 6:07 AM
So this is brand-new and requires curl 7.85 or later, released just 2 months ago.
👍 1
I just tested it on macOS Ventura, and it doesn't work because it ships with 7.84 😞
🙁 1
m

miniature-advantage-69986

11/01/2022, 6:14 AM
Any idea why 127.0.0.1 is not being forwarded to my ingress-controller?
netsh interface ipv4 show route
Copy code
Veröff.  Typ       Met   Präfix                    Idx  Gateway/Schnittstelle
-------  --------  ----  ------------------------  ---  ---------------------
Nein     Manuell   0    0.0.0.0/0                  25  192.168.178.1
Nein     Manuell   0    0.0.0.0/0                  37  192.168.178.1
Nein     Manuell   256  0.0.0.0/0                  40  10.202.59.14
Nein     System    256  10.202.59.12/30            40  Mobilfunk
Nein     System    256  10.202.59.13/32            40  Mobilfunk
Nein     System    256  10.202.59.15/32            40  Mobilfunk
Nein     System    256  127.0.0.0/8                 1  Loopback Pseudo-Interface 1
Nein     System    256  127.0.0.1/32                1  Loopback Pseudo-Interface 1
Nein     System    256  127.255.255.255/32          1  Loopback Pseudo-Interface 1
Nein     System    256  172.26.32.0/20             65  vEthernet (Default Switch)
Nein     System    256  172.26.32.1/32             65  vEthernet (Default Switch)
Nein     System    256  172.26.47.255/32           65  vEthernet (Default Switch)
Nein     System    256  172.27.0.0/20              78  vEthernet (WSL)
Nein     System    256  172.27.0.1/32              78  vEthernet (WSL)
Nein     System    256  172.27.15.255/32           78  vEthernet (WSL)
Nein     System    256  192.168.178.0/24           25  Ethernet 2
Nein     System    256  192.168.178.0/24           37  Ethernet
Nein     System    256  192.168.178.39/32          37  Ethernet
Nein     System    256  192.168.178.60/32          25  Ethernet 2
Nein     System    256  192.168.178.255/32         25  Ethernet 2
Nein     System    256  192.168.178.255/32         37  Ethernet
Nein     System    256  224.0.0.0/4                 1  Loopback Pseudo-Interface 1
Nein     System    256  224.0.0.0/4                25  Ethernet 2
Nein     System    256  224.0.0.0/4                37  Ethernet
Nein     System    256  224.0.0.0/4                40  Mobilfunk
Nein     System    256  224.0.0.0/4                18  Bluetooth-Netzwerkverbindung
Nein     System    256  224.0.0.0/4                44  WLAN
Nein     System    256  224.0.0.0/4                42  LAN-Verbindung* 11
Nein     System    256  224.0.0.0/4                65  vEthernet (Default Switch)
Nein     System    256  224.0.0.0/4                38  LAN-Verbindung* 12
Nein     System    256  224.0.0.0/4                78  vEthernet (WSL)
Nein     System    256  255.255.255.255/32          1  Loopback Pseudo-Interface 1
Nein     System    256  255.255.255.255/32         25  Ethernet 2
Nein     System    256  255.255.255.255/32         37  Ethernet
Nein     System    256  255.255.255.255/32         40  Mobilfunk
Nein     System    256  255.255.255.255/32         18  Bluetooth-Netzwerkverbindung
Nein     System    256  255.255.255.255/32         44  WLAN
Nein     System    256  255.255.255.255/32         42  LAN-Verbindung* 11
Nein     System    256  255.255.255.255/32         65  vEthernet (Default Switch)
Nein     System    256  255.255.255.255/32         38  LAN-Verbindung* 12
Nein     System    256  255.255.255.255/32         78  vEthernet (WSL)
f

fast-garage-66093

11/01/2022, 6:16 AM
Sorry, I don't know. @calm-sugar-3169 any ideas?
m

miniature-advantage-69986

11/02/2022, 11:28 AM
After a factory-reset i managed to get the forwarding working again. I hope this helps others.
24 Views