K3S Ingress to external Service (Home Assistant)

I have K3s install and Traefik working but have moved Home Assistant to its own dedicated hardware.
Is it possible to route my domain name though to my new HA instance from within K3S
If so what should i be looking to configure?

Hello @peterduckett and thanks for your interest in Traefik,

If your Home Assistant has a DNS name reachable from your k3s instance then it should be possible to leverage k8s ExternalName services (see Service | Kubernetes).

If the Home Assistant does not have a DNS name, it could be possible to leverage Headless services (see Service | Kubernetes), if not using a Traefik service configured with the right IP with the file provider would work (see Traefik File Documentation - Traefik and Traefik Services Documentation - Traefik).

Hope this helps!

Ok, So it has the homeasstiant.local address but i dont think this is really a routable DNS name as i think it is done by discovery and is certainly not routable from within a pod which i think is needed for traefik service.

I have tried to headless, but get an error
time="2023-02-21T19:16:06Z" level=error msg="Cannot create service: endpoints not found" namespace=default providerName=kubernetes ingress=ha serviceName=ha2 servicePort="&ServiceBackendPort{Name:,Number:8123,}

Excuse the YAML i got it out of rancher

apiVersion: v1
kind: Service
metadata:
  creationTimestamp: "2023-02-21T18:47:40Z"
  managedFields:
  - apiVersion: v1
    fieldsType: FieldsV1
    fieldsV1:
      f:spec:
        f:clusterIP: {}
        f:externalIPs: {}
        f:internalTrafficPolicy: {}
        f:ports:
          .: {}
          k:{"port":8123,"protocol":"TCP"}:
            .: {}
            f:port: {}
            f:protocol: {}
            f:targetPort: {}
        f:sessionAffinity: {}
        f:type: {}
    manager: rancher
    operation: Update
    time: "2023-02-21T18:47:40Z"
  name: ha2
  namespace: default
  resourceVersion: "129160184"
  uid: 210d0931-52bb-47e0-ad3c-c35586197003
spec:
  clusterIP: None
  clusterIPs:
  - None
  externalIPs:
  - 192.168.10.99
  internalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  - IPv6
  ipFamilyPolicy: RequireDualStack
  ports:
  - port: 8123
    protocol: TCP
    targetPort: 8123
  sessionAffinity: None
  type: ClusterIP
status:
  loadBalancer: {}

But i basically get a 404 as i expect the endpoint is the problem for the 404 as its not getting to HA will dig a bit more into the documentation

Got it working by the looks of it i was missing an end point as there was no selector i couldnt work out that if the service and end point have the same name they map

1 Like