# Cannot deploy Nomad task with Traefik loadbalancing using Nomad's native service discovery

**URL:** <https://community.traefik.io/t/cannot-deploy-nomad-task-with-traefik-loadbalancing-using-nomads-native-service-discovery/18292>\
**Category:** Traefik v2\
**Tags:** consul-catalog\
**Created:** [April 17, 2023, 6:57pm UTC](https://community.traefik.io/t/cannot-deploy-nomad-task-with-traefik-loadbalancing-using-nomads-native-service-discovery/18292 "2023-04-17T18:57:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![avinash](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@avinash](https://community.traefik.io/u/avinash)\
**Post date:** [April 17, 2023, 6:57pm UTC](https://community.traefik.io/t/cannot-deploy-nomad-task-with-traefik-loadbalancing-using-nomads-native-service-discovery/18292/1 "2023-04-17T18:57:03Z")

</div>

Hi all,

I was playing around with Traefik as reverse proxy for my Nomad cluster. I want to make use of Nomad its new service discovery functionalities as described here ([Traefik Proxy Integrates with Hashicorp Nomad | Traefik Labs](https://traefik.io/blog/traefik-proxy-fully-integrates-with-hashicorp-nomad/)) to host my home-assistant container. So this setup is running **without** Consul (sorry, I could not select Nomad as tag only Consul)

The only problem is that I cannot get the Traefik routing to work. The Traefik task is defined as in the example

```auto
job "traefik" {
  datacenters = ["dc1"]
  type = "service"

  group "traefik" {
    count = 1

    network {
      port "http"{
         static = 80
         host_network = "wlan"
      }
      port "admin"{
         static = 8080
         host_network = "wlan"
      }
    }

    service {
      name = "traefik-http"
      provider = "nomad"
      port = "http"
    }

    task "server" {
      driver = "docker"
      config {
        image = "traefik:2.8"
        ports = ["admin", "http"]
        args = [
          "--api.dashboard=true",
          "--api.insecure=true", ### For Test only, please do not use that in production
          "--entrypoints.web.address=:${NOMAD_PORT_http}",
          "--entrypoints.traefik.address=:${NOMAD_PORT_admin}",
          "--providers.nomad=true",
          "--providers.nomad.endpoint.address=http://192.168.178.XX:4646" ### IP to your nomad server
        ]
      }
    }
  }
}

```

The home-assistant container is defined as follows

```auto

variable "homeassistant_password" {
 type = string
}

job "home-assistant" {
  datacenters = ["dc1"]
  type = "service"

  group "home-assistant" {
    count = 1

    network {
      port "http" {
        to = 8123
        static = 8123
        host_network = "wlan"
      }

      port "http-tailscale" {
        to = 8123
        static = 8123
        host_network = "tailscale"
	}
    }

    volume "home-assistant-config" {
      type = "host"
      read_only = false
      source = "home-assistant-config"
    }

    task "home-assistant" {
      driver = "docker"

      volume_mount {
        volume = "home-assistant-config"
        destination = "/config"
        read_only = false
      }

      config {
        image = "ghcr.io/home-assistant/home-assistant:latest"
        ports = ["http", "http-tailscale"]
      }

      template {
        data = <<EOF
         {{- range nomadService "postgres" }}
  	  POSTGRES_URL=REDACTED{{- end }}
        EOF

        destination = "local/file.env"
        env = true
      }

      service {
        name = "home-assistant"
        port = "http"
        provider = "nomad"

      tags = [
        "traefik.enable=true",
        "traefik.http.routers.http.rule=Path(`/ha`)",
      ]

      }
    }
  }
}

```

The problem is however that I dont see the HTTP Router picking this up in the dashboard. When I use `Host()` instead of `Path()` I do see the HTTP Router picking it up, but without me being able to resolve it. Can some more experienced Traefik users maybe give me some pointers here?

Setup: intel nuc running arch linux.

Thanks!

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [April 17, 2023, 8:22pm UTC](https://community.traefik.io/t/cannot-deploy-nomad-task-with-traefik-loadbalancing-using-nomads-native-service-discovery/18292/2 "2023-04-17T20:22:37Z")

</div>

Have you tried latest Traefik v2.10? v2.8 seems a bit old.

---

<div class="post-metadata">

**Author:** ![avinash](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@avinash](https://community.traefik.io/u/avinash)\
**Post date:** [April 19, 2023, 10:31am UTC](https://community.traefik.io/t/cannot-deploy-nomad-task-with-traefik-loadbalancing-using-nomads-native-service-discovery/18292/3 "2023-04-19T10:31:46Z")

</div>

Updated to 2.10, but the situation stays the same.

---

<div class="post-metadata">

**Author:** ![avinash](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@avinash](https://community.traefik.io/u/avinash)\
**Post date:** [April 19, 2023, 5:07pm UTC](https://community.traefik.io/t/cannot-deploy-nomad-task-with-traefik-loadbalancing-using-nomads-native-service-discovery/18292/4 "2023-04-19T17:07:46Z")

</div>

The error was related to the application I am hosting (home-assistant) you cannot host it on a path like /ha. Only on a subdomain.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bd81ebdb578656e76e56ff3cc3eed021d3ba132d.png) [@system](https://community.traefik.io/u/system)\
**Post date:** [April 22, 2023, 5:08pm UTC](https://community.traefik.io/t/cannot-deploy-nomad-task-with-traefik-loadbalancing-using-nomads-native-service-discovery/18292/5 "2023-04-22T17:08:01Z")

</div>

Closed on April 22, 2023, 5:08pm UTC

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