Code Monkey home page Code Monkey logo

jx-health's Introduction

jx-health

Documentation Go Report Card Releases LICENSE Slack Status

jx-health is a small command line tool working with health statuses from Kuberhealthy

Using Kuberhealthy and custom checks we are able to report the health of a Kubernetes cluster by only reading the Kuberhealthy state custom resources. This is good for user RBAC restricted environments as the Kuebrhealthy checks run with a Kubernetes service account to validate things like secrets, without revealing any sensitive data and report errors when a user may not have access.

jx-health is not tied to Jenkins X, it can be installed and used standalone though using Jenkins X 3.x (alpha) makes it easier to get started.

RBAC requirements

The required RBAC needed for users of this command:

Resource Role Namespace Reason
Deployments Get kuberhealthy used to verify Kuberhealthy is running
khstates.v1.comcast.github.io List kuberhealthy used to return the status of default Kuberhealthy checks
khstates.v1.comcast.github.io Watch kuberhealthy used to watch the status of default Kuberhealthy checks
khstates.v1.comcast.github.io List * used to return the status of Jenkins X and custom Kuberhealthy checks in all namespaces
khstates.v1.comcast.github.io Watch * used to watch the status of Jenkins X and custom Kuberhealthy checks in all namespaces

Commands

See the jx-health command reference

Getting Started

There are three parts to using this health plugin:

  1. jx-health client side CLI used to query health checks
  2. Kuberhealthy server side controller used to start checks and capture results
  3. custom server side health checks

Get the CLI

Download the jx-health binary for your operating system and add it to your $PATH.

Install serverside helm charts

Choose one of the two options below:

1. Using vanilla Helm

helm repo add kuberhealthy https://comcast.github.io/kuberhealthy/helm-repos
helm install kuberhealthy kuberhealthy/kuberhealthy -n kuberhealthy --set check.daemonset.enabled=true --set check.deployment.enabled=true --set check.dnsInternal.enabled=true --set check.networkConnection.enabled=true --create-namespace

optionally install the Jenkins X 3.x custom health checks

helm repo add jx3 https://storage.googleapis.com/jenkinsxio/charts
helm install cluster-checks jx3/jx-kh-check -n kuberhealthy --set jxPodStatus.enabled=true --set jxPodStatus.cluster.enabled=true --set jxSecrets.enabled=true --set jxSecrets.cluster.enabled=true
helm install health-checks-jx jx3/jx-kh-check -n jx --set jxWebhooks.enabled=true --set jxBotToken.enabled=true
helm install health-checks-install jx3/jx-kh-check -n jx-git-operator --set jxInstall.enabled=true
jx-health get status --all-namespaces --watch

2. Using Jenkins X 3.x (alpha)

If using Jenkins X 3 alpha then you get the benefits of a top level CLI to manage upgrades and GitOps for you cluster.

Get the plugin by running

jx upgrade cli
jx upgrade plugins

You will also need to upgrade your clusters version stream which updates the cluster to the latest release

jx gitops upgrade

git commit / push then check the git operator job is successful

jx admin logs

Then to add the new server side checks (kuberhealthy ) again from a cloned copy of your cluster git repo, run

jx gitops helmfile add --chart kuberhealthy/kuberhealthy
jx gitops helmfile add --chart jx3/jx-kh-check
jx gitops helmfile add --chart jx3/jx-kh-check --name health-checks-jx
jx gitops helmfile add --chart jx3/jx-kh-check --name health-checks-install

review the local changes, you should see four new charts added to your helmfile.yaml git commit / push then check the git operator job is successful

jx admin logs

get the check statuses

jx health get status --all-namespaces --watch

asciicast

or using the Jenkins X Octant plugin

Developing

Golang 1.15

If you get this error when building:

# github.com/jenkins-x-plugins/jx-health/pkg/health/lookup
pkg/health/lookup/lookup.go:19:20: undefined: Asset
make: *** [build] Error 2

You need to run:

go get -u github.com/go-bindata/go-bindata/...

and

make bind

You can now build this repository using your local modifications and try the locally built binary in build/jx-health or run the unit tests via make test

jx-health's People

Contributors

jenkins-x-bot-test avatar jstrachan avatar rawlingsj avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.