This repository provides a small Python library for reporting check results back to Kuberhealthy. It also includes a runnable example program and container configuration.
Install the client into your own project:
pip install kuberhealthy-clientThe library exposes two helpers:
from kuberhealthy_client import report_ok, report_error
# Environment variables KH_REPORTING_URL and KH_RUN_UUID are read automatically.
report_ok()
report_error("something went wrong")Both functions accept optional url and run_uuid keyword arguments if you prefer to supply values directly.
Set the KH_REPORTING_URL and KH_RUN_UUID environment variables, add your
check logic to example/client.py, and then run:
python3 example/client.pyWithin the main function, uncomment either report_ok() or
report_error("message") after your logic depending on the result.
Use the provided Makefile and Dockerfile to build and publish the check
image.
make build IMG=myrepo/example-check:latest
make push IMG=myrepo/example-check:latest- Add your check logic to
example/client.pyor your own script. Callreport_ok()when the check succeeds orreport_error("message")when it fails. - Build and push your image as shown above.
- Create a
KuberhealthyCheckresource pointing at your image and apply it to any cluster where Kuberhealthy runs:
apiVersion: kuberhealthy.github.io/v2
kind: KuberhealthyCheck
metadata:
name: example-python-check
spec:
image: myrepo/example-check:latest
runInterval: 1m