• Stars
    star
    717
  • Rank 61,668 (Top 2 %)
  • Language Jsonnet
  • License
    MIT License
  • Created over 6 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Cluster monitoring stack for clusters based on Prometheus Operator

Cluster Monitoring stack for ARM / X86-64 platforms

The Prometheus Operator for Kubernetes provides easy monitoring definitions for Kubernetes services and deployment and management of Prometheus instances.

This have been tested on a hybrid ARM64 / X84-64 Kubernetes cluster deployed as this article.

This repository collects Kubernetes manifests, Grafana dashboards, and Prometheus rules combined with documentation and scripts to provide easy to operate end-to-end Kubernetes cluster monitoring with Prometheus using the Prometheus Operator. The container images support AMD64, ARM64, ARM and PPC64le architectures.

The content of this project is written in jsonnet and is an extension of the fantastic kube-prometheus project.

If you like this project and others I've been contributing and would like to support me, please check-out my Patreon page!

Components included in this package:

  • The Prometheus Operator
  • Highly available Prometheus
  • Highly available Alertmanager
  • Prometheus node-exporter
  • kube-state-metrics
  • CoreDNS
  • Grafana
  • SMTP relay to Gmail for Grafana notifications (optional)

There are additional modules (disabled by default) to monitor other components of the infra-structure. These can be enabled or disabled on vars.jsonnet file by setting the module enabled flag in modules to true or false.

The additional modules are:

  • ARM-exporter to generate temperature metrics (works on some ARM boards like RaspberryPi)
  • MetalLB metrics
  • Traefik metrics
  • ElasticSearch metrics
  • APC UPS metrics
  • GMail SMTP relay module

There are also options to set the ingress domain suffix and enable persistence for Grafana and Prometheus.

The ingresses can use TLS with the default self-signed certificate from your Ingress controller by setting TLSingress to true and use a custom certificate by creating the files server.crt and server.key and enabling the UseProvidedCerts parameter at vars.jsonnet.

Persistence for Prometheus and Grafana can be enabled in the enablePersistence section. Setting each to true, creates the volume PVCs. If no PV names are defined in prometheusPV and grafanaPV, the default StorageClass will be used to dynamically create the PVs The sizes can be adjusted in prometheusSizePV and grafanaSizePV.

If using pre-created persistent volumes (samples in samples), check permissions on the directories hosting the files. The UID:GID for Prometheus is 1000:0 and for Grafana is 472:472.

Changing these parameters require a rebuild of the manifests with make followed by make deploy. To avoid installing all pre-requisites like Golang, Jsonnet, Jsonnet-bundler, use the target make docker to build in a container.

Quickstart (non K3s)

The repository already provides a set of compiled manifests to be applied into the cluster or the deployment can be customized thru the jsonnet files.

If you only need the default features and adjust your cluster URL for the ingress, there is no need to rebuild the manifests(and install all tools). Use the change_suffix target with argument suffix=[suffixURL] with the URL of your cluster ingress controller. If you have a local cluster, use the nip.io domain resolver passing your_cluster_ip.nip.io to the suffix argument. After this, just run make deploy.

# Update the ingress URLs
make change_suffix suffix=[suffixURL]

# Deploy
make deploy

To customize the manifests, edit vars.jsonnet and rebuild the manifests.

$ make vendor
$ make
$ make deploy

# Or manually:

$ make vendor
$ make
$ kubectl apply -f manifests/setup/
$ kubectl apply -f manifests/

If you get an error from applying the manifests, run the make deploy or kubectl apply -f manifests/ again. Sometimes the resources required to apply the CRDs are not deployed yet.

If you enable the SMTP relay for Gmail in vars.jsonnet, the pod will be in an error state after deployed since it would not find the user and password on the "smtp-account" secret. To generate, run the scripts/create_gmail_auth.sh script.

Quickstart on Minikube

You can also test and develop the monitoring stack on Minikube. First install minikube by following the instructions here for your platform. Then, follow the instructions similar to the non-K3s deployment:

# Start minikube (if not started)
minikube start

# Enable minikube ingress to allow access to the web interfaces
minikube addons enable ingress

# Get the minikube instance IP
minikube ip

# Run the change_suffix target
make change_suffix suffix=[minikubeIP.nip.io]

# or customize additional params on vars.jsonnet and rebuild
make vendor
make

# and deploy the manifests
make deploy

# Get the URLs for the exposed applications and open in your browser
kubectl get ingress -n monitoring

Quickstart for K3s

To deploy the monitoring stack on your K3s cluster, there are four parameters that need to be configured in the vars.jsonnet file:

  1. Set k3s.enabled to true.
  2. Change your K3s master node IP(your VM or host IP) on k3s.master_ip parameter.
  3. Edit suffixDomain to have your node IP with the .nip.io suffix or your cluster URL. This will be your ingress URL suffix.
  4. Set traefikExporter enabled parameter to true to collect Traefik metrics and deploy dashboard.

After changing these values to deploy the stack, run:

$ make vendor
$ make
$ make deploy

# Or manually:

$ make vendor
$ make
$ kubectl apply -f manifests/setup/
$ kubectl apply -f manifests/

If you get an error from applying the manifests, run the make deploy or kubectl apply -f manifests/ again. Sometimes the resources required to apply the CRDs are not deployed yet.

If you enable the SMTP relay for Gmail in vars.jsonnet, the pod will be in an error state after deployed since it would not find the user and password on the "smtp-account" secret. To generate, run the scripts/create_gmail_auth.sh script.

Ingress

Now you can open the applications:

To list the created ingresses, run kubectl get ingress --all-namespaces, if you added your cluster IP or URL suffix in vars.jsonnet before rebuilding the manifests, the applications will be exposed on:

Updating the ingress suffixes

To avoid rebuilding all manifests, there is a make target to update the Ingress URL suffix to a different suffix. Run make change_suffix suffix="[clusterURL]" to change the ingress route IP for Grafana, Prometheus and Alertmanager and reapply the manifests.

Customizing

The content of this project consists of a set of jsonnet files making up a library to be consumed.

Pre-reqs

The project requires json-bundler and the jsonnet compiler. The Makefile does the heavy-lifting of installing them. You need Go already installed:

git clone https://github.com/carlosedp/cluster-monitoring
cd cluster-monitoring
make vendor
# Change the jsonnet files...
make

After this, a new customized set of manifests is built into the manifests dir. To apply to your cluster, run:

make deploy

To uninstall, run:

make teardown

Images

This project depends on the following images (all supports ARM, ARM64 and AMD64 thru manifests):

Alertmanager Blackbox_exporter Node_exporter Snmp_exporter Prometheus

ARM_exporter

Prometheus-operator

Prometheus-adapter

Grafana

Kube-state-metrics

Addon-resizer

Obs. This image is a clone of AMD64, ARM64 and ARM with a manifest. It's cloned and generated by the build_images.sh script

configmap_reload

prometheus-config-reloader

SMTP-server

Kube-rbac-proxy

More Repositories

1

riscv-bringup

Risc-V journey thru containers and new projects
Shell
255
star
2

kubernetes-arm

Hybrid Kubernetes Cluster on ARM64 and AMD64 nodes
Shell
177
star
3

chiselv

A RISC-V Core (RV32I) written in Chisel HDL
Scala
86
star
4

PlatformIO-Renode-Demos

A collection of demos for PlatformIO framework and Renode simulation platform integration.
C
61
star
5

lbconfig-operator

A Kubernetes/Openshift Operator to configure external Load Balancers
Go
42
star
6

vimfiles

Vim configuration files
Vim Script
37
star
7

ddwrt-monitoring

DD-WRT Router Monitoring Stack
Shell
35
star
8

chisel-playground

Chisel HDL example applications
Scala
28
star
9

openshift-on-footloose

Running Openshift on Footloose, docker in docker
26
star
10

rpi-media-server

Docker compose files to create a Raspberry Pi Media Server
23
star
11

PSP-StacklessPython

Stackless Python 2.5 port for Sony PSP
Python
20
star
12

docker-arm_exporter

ARM CPU temperature exporter for Prometheus - Container builder
Dockerfile
19
star
13

QMTechBaseBoard

BaseBoard design for QMTech Kintex 7 FPGA
18
star
14

zio-scalajs-stack

Full-stack Scala ZIO + Scala.js application for test
Scala
13
star
15

zio-temporal-hello

Sample hello application using Scala 3 and zio-temporal
Scala
13
star
16

dcca-server-OTP

Erlang Diameter Credit Control (DCCA) OTP application
Erlang
12
star
17

mill-docker-nativeimage

A Scala Mill plugin to build container images with Native Image (GraalVM Binaries) application
Scala
12
star
18

openshift-playbooks

Ansible playbooks for multiple Openshift deploy/management tasks
Jinja
12
star
19

diameter-dcca

Erlang Diameter Credit Control Application (DCCA) Server and Client (Discontinued in favor of OTP versions)
Erlang
11
star
20

chisel-fpga-pinfinder

A Chisel implementation for an FPGA Pin Finder thru UART
Scala
11
star
21

zio-channel

Prototype library for Go-like channels in Scala 3 / ZIO 2
Scala
11
star
22

minecraft-server-arm64

Minecraft Server on Docker container for ARM64
Shell
10
star
23

riscvassembler

A RISC-V assembler library for Scala/Chisel HDL projects
Scala
9
star
24

kube-mediaserver

Kubernetes Media Server stack
Dockerfile
9
star
25

container-mgmt

Container management structure
Shell
8
star
26

Reason-KorgNanoKontrol2-Remote

Propellerhead Reason Korg NanoKontrol2 Remote Script
Lua
8
star
27

Reason-MPKMini-Remote

Akai MPK Mini remote script for Reason
Lua
7
star
28

kubernetes-kit

Kubernetes Install kit and guide
Shell
6
star
29

bleepziohttp

Scala Bleep sample project using ZIO and ZIO-HTTP
Scala
6
star
30

qomu_chiselblinky

C
6
star
31

ppc64le-bringup

Tracking and bringing-up projects for the PPC64le architecture
Shell
5
star
32

go-playground

Go playground for projects and apps
Go
5
star
33

carlosedp.github.com

Personal Website/Blog - http://carlosedp.com
SCSS
5
star
34

rebar3_diameter_compiler

Compile Diameter .dia files on Erlang Rebar3 projects
Erlang
5
star
35

dcca-client-OTP

Erlang Diameter Credit Control (DCCA) OTP Client
Erlang
4
star
36

chisel-template

Chisel HDL Template Repository
Scala
4
star
37

BitwigControllers

Bitwig Studio Controller scripts
JavaScript
4
star
38

mill-aliases

A Scala Mill plugin adding task aliases to the build configuration
Scala
4
star
39

stacklessexamples

Python
3
star
40

PMOD1

Documentation and code samples for the PMOD1 - Rotary+RingLED
Scala
3
star
41

scalautils

Scala/Chisel utility methods
Scala
3
star
42

dotfiles

Dotfiles for console configuration on MacOS and Linux
Shell
2
star
43

carlosedp

About me
2
star
44

presentations

Presentations from Talks and Events
2
star
45

MIDI-Footcontroller

MIDI Footcontroller on Arduino
Processing
2
star
46

mill-zsh-completions

Zsh plugin adding Scala Mill build tool completions and prompt display
Shell
2
star
47

homebrew-tap

This is the repository for some custom Homebrew packages
Ruby
2
star
48

rvasmweb

An experimental RISC-V Assembler web app built on Scala.js
Scala
2
star
49

scalatra-demo-metrics

Scala
1
star
50

webdownloader

Web application written in Node.js that allows one to schedule downloads and receive them via email or other sources.
JavaScript
1
star
51

blackbird-openbmc

1
star
52

openhwspaces

OpenHWSpaces repository with discussed topics and reference links
1
star
53

temporal-samples

Scala
1
star