Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.


Repository files navigation

Notice - This is an experimentation project, use for education only


kube-conditioner is a Kubernetes controller that allows you to define custom Kubernetes Pod conditions based on your own logic.


After installing kube-controller (see below) in your Kubernetes cluster, create a CRD like:

kind: PodCondition
  name: conditiontest
  interval: 5000
      itaysk: test
    serverUrl: "http://my.prom.server:9090"
    rule: "myimportantmetric<50"

(see ./config/samples for sample yaml files)

This will:

  • Add a new Pod condition called conditiontest
  • To all Pods with label itaysk: test
  • Determine the status of the by querying Prometheus
    • at http://my.prom.server:9090
    • with the query myimportantmetric<50
    • expecting the query to succeed (result is non empty)
  • Evaluate the condition every 5000 milliseconds


Pod conditions are standard part of the Pod status section. They are described as:

Conditions represent the latest available observations of an object's state. They are an extension mechanism intended to be used when the details of an observation are not a priori known or would not apply to all instances of a given Kind source

Use cases:

  • As a handy customizable sub-status on your pods that you can query manually or from scripts.
  • To determine the Pod readiness state using Readiness Gate.
  • For automatic remediation scenarios.

For more context and information, please see this blog post:


The controller is pluggable by design in regards to how to determin the status of the condition. The current implementation supports running queries against Prometheus in a pretty basic way. This area needs work and additional datasources may be added.

The Prometheus datasource is documented under ./pkg/datasource/prometheus/


There's an image in docker hub and generated deployment files for easy experimentation but the process is not yet automated to get the latest bits it's better to build from source and generate deployment files.

From distribution

kubectl apply -f config/crds
kubectl apply -f

From source

install dependencies:

  • go
  • dep
  • kustomize
  • kubebuilder
  • docker
git clone
cd kube-conditioner
make docker-build
make docker-push
make deploy


PRs/issues are welcome!

Built using:

  • go 1.11.5
  • kube-builder 1.0.8
  • Kubernetes 1.13.2 (minikube)