404 with traefik ingress controller using NodePort service type

I have configured traefik as my ingress controller for my k8s cluster on Digital Ocean. I am using terraform + helm to set up the entire cluster + traefik ingress controller + cert-manager. Everything is working as expected.

However, now I want to use an existing DO load balancer for my traefik ingress controller instead of the LB that automatically gets created by Digital Ocean when creating the LoadBalancer type k8s service for the traefik ingress controller.

In the traefik helm chart I've set the service.type to NodePort and the node ports to 30080 and 30443.

When I point my Digital Ocean load balancer to the nodes on ports 30080 and 30443, I get a 404 error from traefik. So, it does reach the traefik ingress controller but it does not seem to be able to route the request to the correct service.

My Ingress resource looks like this:

resource "kubernetes_ingress_v1" "whoami" {
  metadata {
    name      = "whoami"

    annotations = {
      "traefik.ingress.kubernetes.io/router.entrypoints" : "websecure"
      "traefik.ingress.kubernetes.io/router.tls" : "true"
      "cert-manager.io/cluster-issuer" : "letsencrypt-issuer"

  spec {
    rule {
      host = "my-domain.com"

      http {
        path {
          path      = "/foo"
          path_type = "Prefix"

          backend {
            service {
              name = "whoami"

              port {
                number = 80

    tls {
      secret_name = "my-domain.com-tls"
      hosts = [

If I use the LoadBalancer type service for traefik, everything works as expected through the automatically provisioned LB and I can access the whoami service via Give yourself a better website ยป MY DOMAIN. Does anyone know what I am doing wrong or what I am missing?


When I start the ingress controller with log-level:info I see the following logs in the traefik pod:

11T17:31:21Z" level=warning msg="No domain found in rule PathPrefix(`/`), the TLS options applied for this router will depend on the SNI of each request" entryPointName=websecure routerName=whoami-whoami@kubernetes


When I inspect the access logs for a successful request with service kind LoadBalancer: - - [12/Feb/2023:06:23:33 +0000] "GET / HTTP/2.0" 200 1005 "-" "-" 30 "whoami-whoami-limosa-online@kubernetes" "" 1ms

For the version with service type NodePort and using an existing LB from Digital Ocean: - - [12/Feb/2023:06:23:59 +0000] "GET / HTTP/2.0" - - "-" "-" 39 "-" "-" 0ms

I finally managed to get this working using the default LoadBalancer type for the traefik ingress controller service in combination with the following annotation:

service.annotations.kubernetes.digitalocean.com/load-balancer-id: "id-of-existing-digital-ocean-lb"

More info How to Configure Advanced Load Balancer Settings in Kubernetes Clusters :: DigitalOcean Documentation

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.