This repository contains a minimal Ruby client for creating Kuberhealthy external checks. The reusable client library is packaged as the kuberhealthy-client
gem.
Add the gem to your application. When using Bundler, reference GitHub Packages:
source 'https://rubygems.pkg.github.com/OWNER' do
gem 'kuberhealthy-client'
end
Replace OWNER
with the GitHub organization or user that hosts this repository.
In your check script:
require 'kuberhealthy/client'
# perform check logic...
Kuberhealthy::Client.report_success
- Add your own check logic to
exampleCheck.rb
. - Build the container image:
make build IMAGE=your-registry/ruby-kh-check:latest
- Push the image to your registry:
make push IMAGE=your-registry/ruby-kh-check:latest
- Create a
KuberhealthyCheck
manifest that uses your image and apply it to the cluster where Kuberhealthy runs:apiVersion: kuberhealthy.github.io/v2 kind: KuberhealthyCheck metadata: name: ruby-example-check namespace: kuberhealthy spec: runInterval: 1m timeout: 30s podSpec: containers: - name: ruby-example image: your-registry/ruby-kh-check:latest imagePullPolicy: IfNotPresent
When the check pod starts, Kuberhealthy injects KH_RUN_UUID
and KH_REPORTING_URL
into
its environment. The example script reports success by default and reports failure with a
message if an exception is raised.