healthyk8s
an extensible tool for creating your own "in cluster" health endpoints
Why?
allows for creating a health endpoint for anything - external resources (NFS, S3, whatever) are also easy to add.
How?
add your own "module" into the existing code, and as long as it conforms to the Api interface, it's fairly trivial to call: see the "internal/health" module for a simple starting point to see how it hangs together.
the agent can run on its own, via the deployment, or, as a sidecar container inside an existing pod.
NOTE:
to run this binary directly, without any container funkiness (requires Go 1.15):
git clone https://github.com/nicgrobler/healthyk8s.git && \
cd healthyk8s && \
go build -o server main.go && \
./server
Example?
To call the NFS module, use a POST request like this:
curl -POST http://localhost:8090/health -d'{
"modulename": "nfs",
"module": {
"Threshold":20
}
}'
and, assuming that there is more than 20% free space left, it will repond with:
{
"Healthy":true
}
Call the File module, to check for the existance of a file:
curl -POST http://localhost:8090/health -d'{
"modulename": "file",
"module": {
"Path": "/Users/nicgrobler/code/go/src/gitlab.4data.ch/website/hugo/config.yml"
}
}'
which will return the following, if the file exists:
{
"Healthy":true
}