How does Consul's script(args) check run in my pod?

248 Views Asked by At

I deploy Coscul through helm-chart, and don't enable to inject sidecar.
Then I register service which has args check as below.

    {
      "name": "demo-svc",
      "Address": "demo-svc.default.svc.cluster.local",
      "port": 8080,
      "checks": [
        {
            "name": "args check",
            "args": ["/bin/ls", "/home"],
            "interval": "3s",
            "timeout": "1s"
        }
      ]
    }

And get Output

consul

This health check result is not as expected, it shows the folder that isn't in my pod, looks like the script just runs in Consul-server.

Can the Consul's arges check execute script in my pod?

1

There are 1 best solutions below

0
Blake Covarrubias On BEST ANSWER

Consul health checks are run within the context of the agent that is executing them. Script checks, like the one you provided, will be run by the Consul client/server agent.

If you want to run a health check against your pod, you need to configure a network-level health check (i.e., TCP, HTTP, gRPC, etc) so that the agent can communicate with your target service.