blake / external-mdns

A service to advertise records for Kubernetes resources on a LAN over multicast DNS.
Apache License 2.0
71 stars 9 forks source link

Not detecting any ingresses (k3d and k3s) #19

Open wlonkly opened 10 months ago

wlonkly commented 10 months ago

I'm running external-mdns in k3d, installed from the "with RBAC" example on the README, and while I expect to encounter some mdns issues, I haven't been able to get that far. Here's what's running:

$ kubectl get services --all-namespaces
NAMESPACE              NAME                        TYPE           CLUSTER-IP      EXTERNAL-IP                        PORT(S)                      AGE
default                kubernetes                  ClusterIP      10.43.0.1       <none>                             443/TCP                      115m
kube-system            kube-dns                    ClusterIP      10.43.0.10      <none>                             53/UDP,53/TCP,9153/TCP       115m
kube-system            metrics-server              ClusterIP      10.43.29.60     <none>                             443/TCP                      115m
kube-system            traefik                     LoadBalancer   10.43.34.105    172.27.0.2,172.27.0.3,172.27.0.4   80:31167/TCP,443:31220/TCP   113m
kubernetes-dashboard   kubernetes-dashboard        ClusterIP      10.43.76.41     <none>                             443/TCP                      100m
kubernetes-dashboard   dashboard-metrics-scraper   ClusterIP      10.43.35.73     <none>                             8000/TCP                     100m
default                nginx                       ClusterIP      10.43.195.151   <none>                             80/TCP                       17m

$ kubectl get ingress --all-namespaces
NAMESPACE   NAME              CLASS     HOSTS   ADDRESS                            PORTS   AGE
default     nginx-test        traefik   *       172.27.0.2,172.27.0.3,172.27.0.4   80      9m17s

but it only detects the traefik LoadBalancer, and not the nginx-test ingress:

2023/12/29 01:00:19 Failed to listen [ff02::fb]:5353: listen udp6 [ff02::fb]:5353: setsockopt: no such device
2023/12/29 01:00:19 app.config [default-namespace:"default" expose-ipv4:"true" expose-ipv6:"false" kubeconfig:"/.kube/config" master:"" namespace:"" publish-internal-services:"false" record-ttl:"120" source:"[ingress service]" test:"false" without-namespace:"false"]
2023/12/29 01:00:19 Added traefik.kube-system.local. 120 IN A 172.27.0.2
2023/12/29 01:00:19 Added 2.0.27.172.in-addr.arpa. 120 IN PTR traefik.kube-system.local.
2023/12/29 01:00:19 Added traefik-kube-system.local. 120 IN A 172.27.0.2
2023/12/29 01:00:19 Added 2.0.27.172.in-addr.arpa. 120 IN PTR traefik-kube-system.local.
2023/12/29 01:00:19 Added traefik.kube-system.local. 120 IN A 172.27.0.3
2023/12/29 01:00:19 Added 3.0.27.172.in-addr.arpa. 120 IN PTR traefik.kube-system.local.
2023/12/29 01:00:19 Added traefik-kube-system.local. 120 IN A 172.27.0.3
2023/12/29 01:00:19 Added 3.0.27.172.in-addr.arpa. 120 IN PTR traefik-kube-system.local.
2023/12/29 01:00:19 Added traefik.kube-system.local. 120 IN A 172.27.0.4
2023/12/29 01:00:19 Added 4.0.27.172.in-addr.arpa. 120 IN PTR traefik.kube-system.local.
2023/12/29 01:00:19 Added traefik-kube-system.local. 120 IN A 172.27.0.4
2023/12/29 01:00:19 Added 4.0.27.172.in-addr.arpa. 120 IN PTR traefik-kube-system.local.

The nginx-test ingress is:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: nginx-test
  annotations:
    ingress.kubernetes.io/ssl-redirect: "false"
spec:
  rules:
  - http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: nginx
            port:
              number: 80

It doesn't detect it on startup, and it also doesn't detect it if I delete and apply the ingress again.

Not sure where to start to see what might be going wrong. Any tips? Thanks!

wlonkly commented 10 months ago

I wanted to test this without an additional layer of indirection, so I've tried it in k3s instead of k3d, with the same outcome: it detects ingresses but no services.

plmercereau commented 9 months ago

I bumped into a similar issue. I then realised the ingress host should end with .local in order to be taken into account (see this part of the code).

For instance:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: nginx-test
spec:
  ingressClassName: traefik
  rules:
  - host: nginx-test.local
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
           service:
             name: nginx
             port:
               number: 80