Repository navigation
Description
What is the issue?
I followed the docs here to add the kubernetes operator to a cluster of mine. I then set a few applications up to use the ingressClassName: tailscale to test access via my tailnet. Unfortunately, all the domains for the ingresses that are create just return 404 Page Not Found.
In my tailscale namespace There is a an operator pod as well as a pod for the ingress ie: ts-nginx-ingress-z5c9l-0.
In said pod I see logs
│ 2024/01/20 20:57:19 magicsock: disco: node [aUfAn] d:f7a13c677130fc87 now using 76.155.93.114:5816 mtu=1360 tx=07fc22e9dac4 │
│ 2024/01/20 20:57:30 Accept: TCP{100.118.164.53:53976 > 100.118.231.82:443} 40 tcp non-syn │
│ 2024/01/20 20:58:15 Accept: TCP{100.118.164.53:53976 > 100.118.231.82:443} 40 tcp non-syn │
│ 2024/01/20 20:58:19 magicsock: disco: node [aUfAn] d:f7a13c677130fc87 now using 192.168.1.189:41641 mtu=1360 tx=99cdae0cb6f3 │
│ 2024/01/20 20:59:00 Accept: TCP{100.118.164.53:53976 > 100.118.231.82:443} 40 tcp non-syn │
│ 2024/01/20 20:59:45 Accept: TCP{100.118.164.53:53976 > 100.118.231.82:443} 40 tcp non-syn │
│ 2024/01/20 21:00:30 Accept: TCP{100.118.164.53:53976 > 100.118.231.82:443} 40 tcp non-syn │
│ 2024/01/20 21:01:15 Accept: TCP{100.118.164.53:53976 > 100.118.231.82:443} 40 tcp non-syn │
│ 2024/01/20 21:02:00 Accept: TCP{100.118.164.53:53976 > 100.118.231.82:443} 40 tcp non-syn │
│ 2024/01/20 21:02:45 Accept: TCP{100.118.164.53:53976 > 100.118.231.82:443} 40 tcp non-syn │
│ 2024/01/20 21:03:30 Accept: TCP{100.118.164.53:53976 > 100.118.231.82:443} 40 tcp non-syn │
│ 2024/01/20 21:04:16 Accept: TCP{100.118.164.53:53976 > 100.118.231.82:443} 40 tcp non-syn │
│ 2024/01/20 21:04:26 magicsock: disco: node [aUfAn] d:f7a13c677130fc87 now using 76.155.93.114:5816 mtu=1360 tx=fca36f890f27 │
│ 2024/01/20 21:04:26 magicsock: disco: node [aUfAn] d:f7a13c677130fc87 now using 192.168.1.189:41641 mtu=1360 tx=303f562206c3 │
│ 2024/01/20 21:05:01 Accept: TCP{100.118.164.53:53976 > 100.118.231.82:443} 40 tcp non-syn
Below are some machines from my account. beeverdam-0 is the actual computer that is running the kubernetes cluster and has a tailscale client on it as well (I have tried turning this off and checking connection with no success).

Additionally, the client I am connecting from is using these settings

Steps to reproduce
Setup the tailscale operator per the instructions here.
Deploy a service with an ingressClassName: tailscale
Attempt to navigate to the hostname.
Are there any recent changes that introduced the issue?
Brand new deployment
OS
Linux
OS version
Ubuntu 22.04
Tailscale version
Docker 1.56.1
Other software
- Pihole as local DNS server (I have tried turning off blocking with this)
- MagicDNS (with/without local nameserver override)
- Tailscale client on the same computer running the k8s cluster with the operator.
Bug report
BUG-4237683ac2539c453394f0ddf2e234c514776edd66759ecefb91dcc33d7d5eda-20240120211555Z-b55e1a030a645759

Activity
irbekrm commentedon Jan 20, 2024
Hi @theelderbeever
Could you please clarify- do you mean that you created an
Ingressresource or aService? Could you perhaps paste in theIngressresource (or theService) ?theelderbeever commentedon Jan 20, 2024
@irbekrm My apologies... Created an
Ingressresource.theelderbeever commentedon Jan 20, 2024
FWIW
nslookupreturns the right ip address on the network for both the short name and fqdn.irbekrm commentedon Jan 21, 2024
Thanks for the additional info.
So the
Serviceis nginx? From the first look it seems to me that it might be either between our proxy and the backend or on our proxy when determining the backend handler.There should be a
Statefulsetcreated in tailscale namespace with a singlePodwith named something likets-default-nginx-ingress-ingress..and there also should be a similarly namedSecret.You should be able to see the backend address that proxy will be using under
serve-configkey in thatSecreti.eCould you try to exec to the proxy
Podand see if you can reach the backend paths that you are trying to reach using the proxy address in the serve-config? You should be able toapk add curlin the proxy pod.theelderbeever commentedon Jan 21, 2024
@irbekrm So it looks like handlers isn't even being populated.
The service it is supposed to be pointing to though is reachable from the
ts-nginx-ingress-z5c9l-0pod in thetailscalenamespace.irbekrm commentedon Jan 21, 2024
Hi, thanks for that additional info! Looks like something went wrong at the point when the operator should have populated the serve config.
Could you please paste in the backend
Service?Also, are there any events on the tailscale
Ingress? If there aren't any, would you be able to recreate theIngressand check if our operator writes any events to it?(This is the part of code that deals with writing the serve config, I'm just trying to understand what went wrong, I suspect that maybe it wasn't able to get the Service at the time and didn't retry or similar).
theelderbeever commentedon Jan 21, 2024
Events on the ingress.

I tried manually editing the secret however, the secret just reverts when changing the
serve-configkey.I would suspicious of it not being able to get the Service just once though.... I have this ingress on 3 separate deployments and they all have the same behavior and symptoms.
I will look through the operator code you linked although I am not the best Go reader... I noticed the version is 1.58 on that commit though? Is that chart available? I am on 1.56.1 but can easily upgrade if a newer one has been released.
irbekrm commentedon Jan 21, 2024
@theelderbeever sorry I actually didn't spot the issue on your Ingress spec that you pasted in earlier.
The event is from here.
You have
.hostfield set on the rule, but not on thespec.tls.hosts. If you haverules[0].hostset, you should also setspec.tls.hosts[0]to the same value (we require that because we only support one hostname perIngress, not individual ones per rules).In your case, I think you can either unset
rules[0].hostor set it to a hostname that does not include dots and makes sense for you (the full DNS name will then be<hostname>.tail5ec3.ts.net)irbekrm commentedon Jan 21, 2024
Do let me know if that makes sense and hopefully fixes the issue
theelderbeever commentedon Jan 21, 2024
@irbekrm That was indeed the problem. Thanks for all they help!
theelderbeever commentedon Jan 21, 2024
@irbekrm Quick follow up question. If I wanted to use Cloudflare to set a publicly set name that just resolves to a machine on my tailnet that is using the ingress can I do that?
I have tried both CNAMES to the tailnet address as well as A records to the tailscale ip address(this works for devices using the regular ts client) but neither work for the ingress.
Basically, say I wanted to register the domain
nginx.example.comand point it to the tailscale ingress ie:default-nginx-ingress-ingress.tail5ec3.ts.nethow might I accomplish that?cmd/k8s-operator: don't proceed with Ingress that has no valid backends
cmd/k8s-operator: don't proceed with Ingress that has no valid backends
cmd/k8s-operator: don't proceed with Ingress that has no valid backen…
irbekrm commentedon Jan 23, 2024
@theelderbeever just a heads up that I saw your question. I was under impression that CNAME records should work - but saw some inconsistency there myself. I need to reproduce this again- will aim to get back to you in the next few days.
theelderbeever commentedon Jan 23, 2024
@irbekrm I appreciate it. From what I have turned up so far I think the answer is NO, CNAMES won't work due to the MagicDNS name resolution not being recursive.
I have tried few things so far if it helps
nslookupcan't even find it.Not sure if the above helps but, its where I have gotten so far.
c-p-b commentedon Jan 28, 2024
FWIW regarding configuring DNS to point at a tailscale-enabled nginx-ingress controller Loadbalancer I experimented with similar setups today and this is what I got working
internal.example.compoint at an internal DNS server Tailscale IP on the tailnet (just a coreDNS helm chart I have running in the cluster, exposed to tailnet with the Service annotation)type: LoadBalancerandloadBalancerClass: tailscale, with some subdomain zone likemysubdomain.ingress.internal.example.comnginx-internalnginx-internal.Now you are at the point where you are at a vanilla-like setup and you do all the regular things you need to do to get TLS going for that e.g.
cert-manageretc. if you need TLS all the way to the application.I am guessing there's no current way to have the tailscale operator provision your certs for
myservice.mysubdomain.ingress.internal.example.com, that's kind of on the end user to go off and provision those themselves with something likecert-manager. But it gets you TLS termination at/before the ingress which is usually acceptable for a lot of use cases anyway if you didn't want to be in the business of managing cert-managerAlso there's nothing specific about the above that requires internal DNS, you could set up split DNS and point at cloudflare instead of some internal DNS instead if you wanted to (with the understanding that your internal tailnet urls would be publically visible, though that may be acceptable for you).
N (#4)
cmd/k8s-operator: don't proceed with Ingress that has no valid backen…