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 = {
      "" : "websecure"
      "" : "true"
      "" : "letsencrypt-issuer"

  spec {
    rule {
      host = ""

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

          backend {
            service {
              name = "whoami"

              port {
                number = 80

    tls {
      secret_name = ""
      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 Does anyone know what I am doing wrong or what I am missing?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
March 26, 2023

Hi there,

I could suggest following the steps from this documentation here:

In that tutorial, you learn how to use a NodePort service and ExternalDNS to make services on a DOKS cluster accessible for applications on Droplets, which will also work for existing Load Balancer within that VPC.

Though, it is more straightforward to create a service with type LoadBalancer and use the newly created Load Balancer.

Hope that this helps.



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel
Get started for free

Enter your email to get $200 in credit for your first 60 days with DigitalOcean.

New accounts only. By submitting your email you agree to our Privacy Policy.

© 2023 DigitalOcean, LLC.