Nomad HTTP 健康检查似乎没有发生

Nomad HTTP health check does not seem to occur

似乎没有进行 HTTP 健康检查,我得出这个结论是因为 HTTP 调试日志没有显示任何定期的定期请求。

是否有任何额外的配置请求来进行健康检查?

job "example" {

  datacenters = ["dc1"]
  type = "service"


  update {
    max_parallel = 1
    min_healthy_time = "10s"
    healthy_deadline = "3m"
    progress_deadline = "10m"
    auto_revert = false
    canary = 0
  }

  migrate {
    max_parallel = 1
    health_check = "checks"
    min_healthy_time = "10s"
    healthy_deadline = "5m"
  }

  group "app" {
    count = 1

    restart {
      attempts = 2
      interval = "30m"

      delay = "15s"

      mode = "fail"
    }

    ephemeral_disk {

      size = 300
    }

    task "app" {
      driver = "docker"

      config {
        image = "localhost:5000/myhub:latest"
        command = "python"
        args = [
          "manage.py",
          "runserver",
          "0.0.0.0:8001"
        ]

        port_map {
          app = 8001
        }
        network_mode = "host"
      }

      resources {
        cpu    = 500
        memory = 256
        network {
          mbits = 10
          port "app" {}
        }
      }

      service {
        name = "myhub"
        port = "app"
        check {
          name     = "alive"
          type     = "http"
          port     = "app"
          path     = "/"
          interval = "10s"
          timeout  = "3s"
        }
      }
    }
  }
}

似乎必须安装 Consul 才能发生这种情况。

还要确保安装 Consul v1.4.2 或更高版本,因为 v1.4.1 似乎有一个错误:https://github.com/hashicorp/consul/issues/5270