Hi @chiyt27,
This is a known bug in Consul. The problem is explained in detail at service script health checks not working · Issue #6923 · hashicorp/consul · GitHub.
As a workaround, you can register the service to Consul using the /agent/service/register API.
demo-svc-api-reg.json
{
"name": "demo-svc",
"tags": [
"default"
],
"Address": "demo-service.default.svc.cluster.local",
"port": 8080,
"checks": [
{
"id": "demo-args",
"name": "args check",
"args": [
"/tmp/test.sh"
],
"interval": "10s",
"timeout": "1s"
}
]
}
$ curl --request PUT --data @demo-svc-api-reg.json http://127.0.0.1:8500/v1/agent/service/register