Skip to content

kuberhealthy/bash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bash Check Example

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.

Using the example

  1. Add your logic – Replace the placeholder section in check.sh with commands that verify the condition you care about. Call report_success when the check passes or report_failure "message" when it fails.

  2. Build the image – Build a container that runs the script:

    make build IMAGE=your-registry/bash-check TAG=v1
  3. Push the image – Push the image to a registry accessible by your cluster:

    make push IMAGE=your-registry/bash-check TAG=v1
  4. 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.

About

Kuberhealthy client in bash

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published