项目作者: nabadger

项目描述 :
Helper jsonnet / kustomize to configure and render the upstream kubernetes-mixins project
高级语言: Jsonnet
项目地址: git://github.com/nabadger/monitoring-mixins.git
创建时间: 2019-09-15T14:39:36Z
项目社区:https://github.com/nabadger/monitoring-mixins

开源协议:

下载


Kubernetes Mixins

Overview

Extend functionality of Kubernetes Mixin.

  • Provide configuration file to override mixin options
  • Provide filter function to remove unwanted rulesand allow customized

Install Deps

  1. go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
  2. go get github.com/brancz/gojsontoyaml

Usage

Import vendor upstream via jsonnet-bundler.

  1. jb install

Generate rendered manifests into the ./manifests directory.

  1. make

This renders prometheus rules into ./manifests and grafana dashboards into ./dashboards.

Configuration

Upstream configuration of kubernetes-mixin can be done in config.jsonnet

Modifiying rules and alerts can be done in main.jsonnet

Ignoring Groups

Filter out entire groups (handy for managed clusters such as GKE where you cannot monitor the api-server).

  1. local ignore_groups = [
  2. 'kube-scheduler.rules',
  3. 'kube-apiserver.rules'
  4. ];

Ignoring Alerts

Filter out specific rules by name

  1. local ignore_alerts = [
  2. 'KubeAPIErrorsHigh',
  3. 'KubeAPILatencyHigh',
  4. 'KubeClientCertificateExpiration'
  5. ];

Updating Expressions

A map of expression overrides where the key is either rule.alert or rule.record name and the value is the new expression.

  1. local expr_overrides = {
  2. 'namespace:container_cpu_usage_seconds_total:sum_rate': 'sum(rate(container_cpu_usage_seconds_total{job="cadvisor", image!="", container!="POD"}[5m])) by (namespace)',
  3. KubeletDown: 'absent(up{job="kubelet"} == 1)',
  4. };