Skip to content

kuberhealthy/ruby

Repository files navigation

Ruby Client Example

This repository contains a minimal Ruby client for creating Kuberhealthy external checks. The reusable client library is packaged as the kuberhealthy-client gem.

Installing the client library

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

Using this example

  1. Add your own check logic to exampleCheck.rb.
  2. Build the container image:
    make build IMAGE=your-registry/ruby-kh-check:latest
  3. Push the image to your registry:
    make push IMAGE=your-registry/ruby-kh-check:latest
  4. 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.

About

Ruby client for Kuberhealthy

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published