Add Prometheus template to Kubernetes Catalog (#181)

* Add Prometheus to Kubernetes Catalog

* Updated config.yml

* Aligning version in spec with config

The version in rancher-compose.yml was different than in config.yml
This commit is contained in:
Girish Shilamkar 2016-07-11 23:18:27 +05:30 committed by Bill Maxwell
parent 4849be7375
commit 3550b050db
16 changed files with 345 additions and 0 deletions

View File

@ -0,0 +1,25 @@
# Prometheus
### Info:
This template deploys a collection of containers based upon the technologies below, once deployed you should have a monitoring platform capable of querying all aspects of your environment with some nice pre-built dashboards.
In this deployment the following technologies are utilised to make this as useful as possible.
* **Prometheus** - Used to scrape and store metrics from our data sources. (https://github.com/prometheus/prometheus)
* **Prometheus Node Exporter** - Gets host level metrics and exposes them to Prometheus. (https://github.com/prometheus/node_exporter)
* **Ranch-Eye** - Pre-configured lightwieght haproxy to expose the cadvsior stats used by Rancher's agent container, to Prometheus. (https://github.com/Rucknar/ranch-eye)
* **Grafana** - Used to visualise the data from Prometheus and InfluxDB. (https://github.com/grafana/grafana/)
* **InfluxDB** - Used as database for storing rancher server metrics that rancher exports via the graphite connector. (https://github.com/influxdata/influxdb)
* **rancher-api-integration** - Allows Prometheus to access the Rancher API and return the status of any stack or service in the rancher environment associated with the API key used.(https://github.com/Limilo/prometheus-rancher-exporter/)
To get the full compliment of metrics available,you need to configure the Rancher `graphite.host` address. This can be done automatically when you deploy the template by choosing the option below, for more information or how to do this change manually,see the following [guide](https://github.com/Rucknar/Guide_Rancher_Monitoring)
All components in this stack are open source tools available in the community. All this template does is to bound them together in an easy to use package.
I expect most people who find this useful will make use of this as a starting point and develop it further around their own needs.
## Deployment:
* Select Prometheus from the community catalog.
* Click deploy.
## Usage
* Grafana will now be available on, running on port 3000. I've added a number of dashboards to help get you started. Authentication is with the default `admin/admin`.
* Prometheus will now be available, running on port 9090. Have a play around with some of the data. For more information on Prometheus - https://prometheus.io/docs/introduction/overview/

View File

@ -0,0 +1,18 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: grafana-rc
namespace: default
spec:
replicas: 1
selector:
template:
metadata:
labels:
name: grafana
spec:
restartPolicy: Always
containers:
- image: infracloud/grafana
imagePullPolicy: Always
name: grafana

View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: grafana
namespace: "default"
spec:
type: NodePort
ports:
- name: "grafana"
port: 3000
protocol: TCP
selector:
name: grafana

View File

@ -0,0 +1,26 @@
apiVersion: v1
kind: ReplicationController
metadata:
labels:
name: influxdb-rc
namespace: default
spec:
replicas: 1
template:
metadata:
labels:
name: influxdb
spec:
restartPolicy: Always
containers:
- image: tutum/influxdb:0.10
imagePullPolicy: Always
name: influxdb
env:
- name: PRE_CREATE_DB
value: grafana;prometheus;rancher
- name: GRAPHITE_DB
value: rancher
- name: GRAPHITE_BINDING
value: :2003

View File

@ -0,0 +1,22 @@
apiVersion: v1
kind: Service
metadata:
name: influxdb
namespace: "default"
spec:
type: NodePort
ports:
- port: 8083
protocol: TCP
name: idb-1
- port: 8086
protocol: TCP
name: idb-2
- port: 8090
protocol: TCP
name: idb-3
- port: 2003
protocol: TCP
name: idb-4
selector:
name: influxdb

View File

@ -0,0 +1,21 @@
apiVersion: v1
kind: ReplicationController
metadata:
labels:
name: node-exporter-rc
namespace: default
spec:
replicas: 1
template:
metadata:
labels:
name: node-exporter
spec:
restartPolicy: Always
containers:
- image: prom/node-exporter:latest
imagePullPolicy: Always
name: node-exporter

View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: node-exporter
namespace: "default"
spec:
ports:
- name: "node-exporter"
port: 9100
protocol: TCP
selector:
name: node-exporter

View File

@ -0,0 +1,27 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: prometheus-rancher-exporter-rc
namespace: default
spec:
replicas: 1
selector:
template:
metadata:
labels:
name: prometheus-rancher-exporter
spec:
restartPolicy: Always
containers:
- image: infinityworks/prometheus-rancher-exporter:04
imagePullPolicy: Always
name: prometheus-rancher-exporter
ports:
- containerPort: 9010
env:
- name: CATTLE_ACCESS_KEY
value: "${cattle_access_key}"
- name: CATTLE_SECRET_KEY
value: "${cattle_secret_key}"
- name: CATTLE_CONFIG_URL
value: "${cattle_config_url}"

View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: prom-rancher-exporter
namespace: "default"
spec:
ports:
- name: prometheus-rancher-exporter
port: 9010
protocol: TCP
selector:
name: prometheus-rancher-exporter

View File

@ -0,0 +1,26 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: prometheus-rc
namespace: default
spec:
replicas: 1
selector:
template:
metadata:
labels:
name: prometheus
spec:
restartPolicy: Always
containers:
- image: infracloud/prometheus
command:
- /bin/prometheus
- -alertmanager.url=http://alertmanager:9093
- -config.file=/etc/prometheus/prometheus.yml
- -storage.local.path=/prometheus -web.console.libraries=/etc/prometheus/console_libraries
- -web.console.templates=/etc/prometheus/consoles
imagePullPolicy: Always
name: prometheus
ports:
- containerPort: 9090

View File

@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: prometheus
namespace: "default"
spec:
type: NodePort
ports:
- name: "prometheus"
port: 9090
protocol: TCP
selector:
name: prometheus

View File

@ -0,0 +1,26 @@
apiVersion: v1
kind: ReplicationController
metadata:
labels:
io.rancher.scheduler.global: "true"
io.rancher.container.dns: "true"
name: ranch-eye-rc
namespace: default
spec:
replicas: 1
selector:
template:
metadata:
labels:
name: ranch-eye
spec:
restartPolicy: Always
containers:
- image: infracloud/ranch-eye
imagePullPolicy: Always
name: ranch-eye
env:
- name: CADVISOR_HOST_IP
value: "${host_ip}"

View File

@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: ranch-eye
labels:
io.rancher.scheduler.global: "true"
io.rancher.container.dns: "true"
spec:
ports:
- port: 9104
protocol: TCP
targetPort: 9104
selector:
name: ranch-eye

View File

@ -0,0 +1,77 @@
.catalog:
name: "Prometheus"
version: "1.1.0"
description: "Prometheus Monitoring Solution"
uuid: prometheus-1
minimum_rancher_version: v0.56.0
questions:
- variable: "cattle_config_url"
label: "Rancher Server URL"
required: true
default: "http://127.0.0.1:8080/v1"
type: "string"
- variable: "cattle_access_key"
label: "Rancher Environement Access Key"
required: true
default: "349CE0C4418D09F1D4AC"
type: "string"
- variable: "cattle_secret_key"
label: "Rancher Environement Secret Key"
required: true
default: "HdhPUKDhUCzGVyrFHW1UJ1thc5LFtfkYVH4Ge8QL"
type: "string"
- variable: "host_ip"
label: "Host IP for Rancher Agent"
required: true
default: "127.0.0.1"
type: "string"
ranch-eye:
upgrade_strategy:
start_first: true
node-exporter:
upgrade_strategy:
start_first: true
prometheus:
scale: 1
health_check:
port: 9090
interval: 5000
unhealthy_threshold: 3
request_line: ''
healthy_threshold: 2
response_timeout: 5000
influxdb:
scale: 1
health_check:
port: 8086
interval: 5000
unhealthy_threshold: 3
request_line: ''
healthy_threshold: 2
response_timeout: 5000
grafana:
scale: 1
health_check:
port: 3000
interval: 5000
unhealthy_threshold: 3
request_line: ''
healthy_threshold: 2
response_timeout: 5000
prometheus-rancher-exporter:
scale: 1
upgrade_strategy:
start_first: true
health_check:
port: 9010
interval: 5000
unhealthy_threshold: 3
request_line: ''
healthy_threshold: 2
response_timeout: 5000

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="256px" height="257px" viewBox="0 0 256 257" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid">
<g>
<path d="M128.001129,0.667 C57.3110392,0.667 0,57.9712627 0,128.663612 C0,199.353702 57.3110392,256.662482 128.001129,256.662482 C198.69122,256.662482 256,199.353702 256,128.663612 C256,57.9712627 198.688961,0.667 128.001129,0.667 L128.001129,0.667 Z M128.001129,240.227234 C107.888506,240.227234 91.5820105,226.791712 91.5820105,210.223193 L164.420248,210.223193 C164.420248,226.789453 148.113753,240.227234 128.001129,240.227234 L128.001129,240.227234 Z M188.153777,200.286599 L67.8417054,200.286599 L67.8417054,178.470817 L188.156036,178.470817 L188.156036,200.286599 L188.153777,200.286599 Z M187.72234,167.242172 L68.1850476,167.242172 C67.7874935,166.78363 67.3809041,166.331864 66.9969029,165.866545 C54.6817608,150.913089 51.7814229,143.106572 48.9646617,135.150972 C48.9172262,134.888948 63.8977879,138.211687 74.5210662,140.601529 C74.5210662,140.601529 79.9874353,141.866474 87.9791764,143.32342 C80.3059303,134.328758 75.7498699,122.894559 75.7498699,111.207372 C75.7498699,85.5493202 95.4287983,63.1281719 88.3292951,45.0055775 C95.2390566,45.5680262 102.629949,59.5885851 103.12915,81.5105319 C110.474866,71.3593491 113.549134,52.8211299 113.549134,41.4546964 C113.549134,29.6861912 121.303698,16.015751 129.060521,15.5481732 C122.146242,26.9439714 130.851773,36.7134119 138.590525,60.9484008 C141.493122,70.0514864 141.122674,85.3708727 143.363433,95.0861012 C144.106589,74.9079713 147.576152,45.4663788 160.376942,35.301643 C154.729867,48.1024336 161.212709,64.1197984 165.646793,71.8201505 C172.800508,84.2437164 177.137462,93.6562617 177.137462,111.458102 C177.137462,123.393761 172.730485,134.631441 165.296674,143.416032 C173.749217,141.830333 179.586034,140.400493 179.586034,140.400493 L207.035338,135.044807 C207.037597,135.042548 203.048503,151.446173 187.72234,167.242172 L187.72234,167.242172 Z" fill="#DA4E31"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1,4 @@
name: "Prometheus"
description: "Prometheus and friends, auto-discovering monitoring solution for Rancher deployments"
version: "1.1.0"
category: "Monitoring"