Giter Club home page Giter Club logo

prometheus-fake-exporter's Introduction

Prometheus fake exporter

How to run it

This project was created just to test K8S Horizontal Pod Autoscaler. It exports fake_metric with a value fetched from http_endpoint.

Arguments required:

  • namespace
  • name of the additional label
  • value of the additional label
  • http endpoint serving float value like github raw gist

HPA (Horizontal Pod Autoscaler) on Kubernetes

Below you will find code snippet with prometheus-fake-exporter deployment and HPA associated with that deployment scaling based on Object Deployment metric. By replacing a value in github gist you can change HPA behaviour and see how it works for yourself.

---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: prometheus-fake-exporter
spec:
  replicas: 1
  template:
    metadata:
      annotations:
        # Automatic prometheus scraping
        prometheus.io/port: '9100'
        prometheus.io/scrape: 'true'
        scope: cluster
      labels:
        app: prometheus-fake-exporter
    spec:
      automountServiceAccountToken: false
      containers:
      - image: 3h4x/prometheus-fake-exporter:latest
        name: prometheus-fake-exporter
        ports:
        - containerPort: 9100
        env:
        - name: LABEL_NAME
          value: deployment
        - name: LABEL_VALUE
          value: prometheus-fake-exporter
        - name: VALUE_HTTP_ENDPOINT
          value: https://gist.githubusercontent.com/3h4x/38ba057db9cbb80c7bf8ad768a90d086/raw/value
        - name: POD_NAMESPACE
          valueFrom:	
            fieldRef:	
              fieldPath: metadata.namespace
---
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
  name: prometheus-fake-exporter
spec:
  maxReplicas: 40
  minReplicas: 10
  scaleTargetRef:
    apiVersion: extensions/v1beta1
    kind: Deployment
    name: prometheus-fake-exporter
  metrics:
  - type: Object
    object:
      metricName: fake_metric
      target:
        kind: Deployment
        name: prometheus-fake-exporter
      targetValue: 10

prometheus-fake-exporter's People

Contributors

3h4x avatar

Stargazers

 avatar

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.