We can register an external service with a built-in /health REST endpoint. The Consul dashboard or the Consul monitor command can invoke the /health endpoint to monitor the health of the external service. This feature makes Consul useful for integration purposes.
Let's understand this through an example.
In this section, we will extract a go binary from the counting microservice and run it on the VM host as a systemd service. Copy the counting-service Go binary from the counting pod's /app directory to the host's home directory and then make it executable. Now, follow these steps:
- Extract the counting service binary and copy it to the VM:
$ kubectl -n consul -c counting cp counting:counting-service ~/counting-service
$ chmod +x ~/counting-service
$ sudo cp ~/counting-service /bin
- Define a systemd service in the local VM in order...