This directory demonstrates a minimal Kuberhealthy check written in Bash. The check.sh
script reads the KH_RUN_UUID
and KH_REPORTING_URL
environment variables that Kuberhealthy sets on checker pods and exposes helper functions for reporting success or failure back to Kuberhealthy.
-
Add your logic – Replace the placeholder section in
check.sh
with commands that verify the condition you care about. Callreport_success
when the check passes orreport_failure "message"
when it fails. -
Build the image – Build a container that runs the script:
make build IMAGE=your-registry/bash-check TAG=v1
-
Push the image – Push the image to a registry accessible by your cluster:
make push IMAGE=your-registry/bash-check TAG=v1
-
Create a KuberhealthyCheck – Reference the image in a
KuberhealthyCheck
resource and apply it to your cluster:apiVersion: kuberhealthy.github.io/v2 kind: KuberhealthyCheck metadata: name: bash-example namespace: kuberhealthy spec: runInterval: 1m podSpec: containers: - name: bash image: your-registry/bash-check:v1 imagePullPolicy: IfNotPresent
When the pod runs, check.sh
will report its result to Kuberhealthy. Set the FAIL=true
environment variable to simulate a failure.
You can copy check.sh
into your own repository and adapt it to implement custom checks.