Coder Social home page Coder Social logo

cmur2 / promgen-k8s Goto Github PK

View Code? Open in Web Editor NEW
10.0 4.0 2.0 75 KB

A modular Prometheus 2 configuration file generator to monitor multiple Kubernetes clusters with a single Prometheus instance.

License: Apache License 2.0

Python 100.00%
prometheus kubernetes configuration generator aws kops

promgen-k8s's Introduction

promgen-k8s

ci

A modular Prometheus 2 configuration file generator to monitor multiple Kubernetes clusters with a single Prometheus instance.

Scenario

You have one Kubernetes cluster per environment (dev, qa, staging, production, etc.) for whichever reasons including e.g. special permission model, limiting the blast radius of problems related to Kubernetes or to test Kubernetes upgrades in staging environment first. You have a separate Kubernetes cluster for operations that runs your monitoring and logging setup, CI pipeline, etc. You want to monitor all environments/clusters with a single Prometheus instance located in the operations cluster.

Writing, modifying and maintaining the prometheus.yml for one Kubernetes cluster by hand is tedious and error prone. Doing so for multiple clusters that should share most of the configuration except for specific rules can become a nightmare.

promgen-k8s aims to provide a toolkit allowing you to easily generate a prometheus.yml tailored for monitoring multiple Kubernetes clusters with invididual scraping jobs and relabeling rules per cluster.

Current State

promgen-k8s is currently in a very early state where it manages to generate the example prometheus-kubernetes.yml for multiple clusters using autodiscovery including custom relabeling rules per cluster. It assumes that it can reach all Kubernetes apiservers by predictable DNS names using the provided secret files for authentication.

For ingresses, pod, service and service endpoint monitoring in remote clusters promgen-k8s uses the Kubernetes apiservers as an HTTP proxy.

As ingresses and services are checked using the blackbox-exporter promgen-k8s also assumes a blackbox-exporter pod and service in monitoring namespace running in each cluster (including remote clusters).

promgen-k8s is successfully used with Kubernetes 1.8 clusters on AWS created by kops.

Example

The example uses a stub file for manual configuration and can be tested using pip install promgen-k8s and then python example-generator.py.

Related Work

  • https://github.com/line/promgen

Doing a Release

You need to have the Poetry dependency manager installed and a PyPI account (a test account works as well) including an authentication token.

Testing the Release

One-time setup:

poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry config pypi-token.testpypi TOKEN_FROM_TESTPYPI_ACCOUNT

Bump version in pyproject.toml, update the changelog with new release and date and commit.

Build and release:

poetry publish -r testpypi --build

Check installation:

pip install --index-url https://test.pypi.org/simple/ promgen_k8s

Official Release

One-time setup:

poetry config pypi-token.pypi TOKEN_FROM_PYPI_ACCOUNT

Bump version in pyproject.toml, update the changelog with new release and date and commit.

Build and release:

poetry publish --build

Check installation:

pip install promgen_k8s

License

promgen-k8s is licensed under the Apache License, Version 2.0. See LICENSE for more information.

promgen-k8s's People

Contributors

cmur2 avatar pyup-bot avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

promgen-k8s's Issues

Dependency Dashboard

View repository job log here.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v4
  • actions/setup-python v4
  • actions/checkout v4
pep621
pyproject.toml
  • poetry >=1.0
poetry
pyproject.toml
  • python ^3.7
  • pyyaml *
  • pylint *
  • pytest *
  • snapshottest *
  • rope *
  • toml *
  • yapf *
  • mypy *
  • types-pyyaml *

  • Check this box to trigger a request for Renovate to run again on this repository

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.