Skip to content
Branch: master
Find file History
gouthamve and tomwilkie update to AM@0.17.0
This has the fix to PD where descriptions longer than 1024 chars are being dropped.
Latest commit d1a4ed7 May 7, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Only support prom datasources in prometheus-ksonnet Apr 30, 2019 Update versions and add Readme Dec 10, 2018
images.libsonnet update to AM@0.17.0 May 7, 2019
jsonnetfile.json Update dependancies. Nov 19, 2018
prometheus-ksonnet.libsonnet Update dependancies. Nov 19, 2018

Prometheus Ksonnet Mixin

A set of extensible configs for running Prometheus on Kubernetes.


$ brew install
$ brew pin ks
$ ks version
ksonnet version: v0.8.0
jsonnet version: v0.9.5
client-go version: v1.6.8-beta.0+$Format:%h$
  • In your config repo, if you don't have a ksonnet application, make a new one (will copy credentials from current context):
$ ks init <application name>
$ cd <application name>
$ go get
$ jb install
  • Assuming you want to run in the default namespace ('environment' in ksonnet parlance), add the following to the file environments/default/main.jsonnet:
local prometheus = import "prometheus-ksonnet/prometheus-ksonnet.libsonnet";

prometheus {
  _config+:: {
    namespace: "default",
  • Apply your config:
$ ks apply default


If you made your Kubernetes cluster with Kops, add the Kops mixin to your config to scrape the Kubernetes system components:

local prometheus = import "prometheus-ksonnet/prometheus-ksonnet.libsonnet";
local kops = import "prometheus-ksonnet/lib/prometheus-config-kops.libsonnet";

prometheus + kops {
  _config+:: {
    namespace: "default",
    insecureSkipVerify: true,

Customising and Extending.

The choice of Ksonnet for configuring these jobs was intention; it allows users to easily override setting in these configurations to suit their needs, without having to fork or modify this library. For instance, to override the resource requests and limits for the Prometheus container, you would:

local prometheus = import "prometheus-ksonnet/prometheus-ksonnet.libsonnet";

prometheus {
     $.util.resourcesRequests("1", "2Gi") +
     $.util.resourcesLimits("2", "4Gi"),

We sometimes specify config options in a _config dict; there are two situations under which we do this:

  • When you must provide a value for the parameter (such as namesapce).
  • When the parameter get referenced in multiple places, and overriding it using the technique above would be cumbersome and error prone (such as with cluster_dns_suffix).

We use these two guidelines for when to put parameters in _config as otherwise the config field would just become the same as the jobs it declares - and lets not forget, this whole thing is config - so its completely acceptable to override pretty much any of it.

You can’t perform that action at this time.