Giter Club home page Giter Club logo

thanos-k3s-setup's Introduction

Deploy a full-fledged Thanos-based setup build on top of Prometheus-Operator locally on k3s and Minio.

Features:

  • k3s-based lightweight Kubernetes spinning up two clusters with each two nodes
  • S3 storage via Minio offering unlimited retention while Prometheus retention is minimal
  • manifests for all Thanos component (except Ruler)
  • Thanos global view across the clusters: Control-plane (cp) has access to the metrics of the customer-cluster (cc)
  • Grafana connected to Thanos Query within cp
  • automated via bash scripts (using docker-compose, docker, helm, kubectl)

This work is meant for testing only, in order to understand each component, and not at all production-ready.

Architecture

architecture

Note that the current setup only deploys one Prometheus per cluster, but the architecture diagram pictures multiple ones. I wanted to show that Thanos can also deal with that kind of setup, having multiple Prometheis running in parallel but also as a HA setup using Thanos deduplication features.

Requirements

Make sure you have docker, docker-compose, kubectl and helm installed and set up in your PATH.

Setup

  1. Set up Kubernetes clusters and Minio Server locally: Within local-setup/ run ./startup.sh.
  2. Deploy and setup the Prometheus-Thanos setup: Run ./setup-all.

Work with it

You can use kubectl and helm as follows (e.g. for cc cluster:):

kubectl --kubeconfig=local-setup/kubeconfig-cc.yaml get pods --all-namespaces
helm --kubeconfig=local-setup/kubeconfig-cc.yaml --home=local-setup/.helm-cc list

The setup exposes the following UIs to the host, which you can access in your browser:

  • Prometheus cp: http://localhost:21090
  • Prometheus cc: http://localhost:22090
  • Thanos cp: http://localhost:21190
  • Thanos cc: http://localhost:22190
  • Grafana cp: http://localhost:21300 (username: admin, password: admin123)
  • S3 (Minio): http://localhost:19000 (username: admin, password: admin123)

For example, open Grafana http://localhost:21300 and go to the Explore window, select the Thanos datasource and browse happily across both your clusters' metrics with unlimited retention utilizing S3 storage.

Note that Grafana Dashboards for Thanos components are not yet automatically deployed. Feel free to import them in Grafana (see dashboards/).

Cleanup (full)

Within local-setup/ simply run ./cleanup.sh.

Further Links

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.