Skip to content

Commit

Permalink
Merge pull request #2 from camilb/kube-state-metrics
Browse files Browse the repository at this point in the history
Add Kubernetes state metrics. Fix Grafana EC2 dashboard. Bump Prometehus to v1.3.1.
  • Loading branch information
camilb authored Nov 16, 2016
2 parents 21844cc + d167cda commit bc0551a
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 17 deletions.
30 changes: 15 additions & 15 deletions definitions/grafana/grafana-dashboards/ec2-instances.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "prometheus.default.svc.cluster.local",
"datasource": "prometheus.monitoring.svc.cluster.local",
"decimals": null,
"editable": true,
"error": false,
Expand Down Expand Up @@ -106,7 +106,7 @@
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"datasource": "prometheus.default.svc.cluster.local",
"datasource": "prometheus.monitoring.svc.cluster.local",
"editable": true,
"error": false,
"format": "none",
Expand Down Expand Up @@ -189,7 +189,7 @@
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "prometheus.default.svc.cluster.local",
"datasource": "prometheus.monitoring.svc.cluster.local",
"editable": true,
"error": false,
"format": "none",
Expand Down Expand Up @@ -268,7 +268,7 @@
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "prometheus.default.svc.cluster.local",
"datasource": "prometheus.monitoring.svc.cluster.local",
"editable": true,
"error": false,
"format": "bytes",
Expand Down Expand Up @@ -347,7 +347,7 @@
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "prometheus.default.svc.cluster.local",
"datasource": "prometheus.monitoring.svc.cluster.local",
"editable": true,
"error": false,
"format": "bytes",
Expand Down Expand Up @@ -426,7 +426,7 @@
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "prometheus.default.svc.cluster.local",
"datasource": "prometheus.monitoring.svc.cluster.local",
"editable": true,
"error": false,
"format": "s",
Expand Down Expand Up @@ -507,7 +507,7 @@
{
"aliasColors": {},
"bars": false,
"datasource": "prometheus.default.svc.cluster.local",
"datasource": "prometheus.monitoring.svc.cluster.local",
"decimals": 2,
"editable": true,
"error": false,
Expand Down Expand Up @@ -589,7 +589,7 @@
"free": "#7EB26D"
},
"bars": false,
"datasource": "prometheus.default.svc.cluster.local",
"datasource": "prometheus.monitoring.svc.cluster.local",
"editable": true,
"error": false,
"fill": 1,
Expand Down Expand Up @@ -677,7 +677,7 @@
"free": "#7EB26D"
},
"bars": false,
"datasource": "prometheus.default.svc.cluster.local",
"datasource": "prometheus.monitoring.svc.cluster.local",
"editable": true,
"error": false,
"fill": 7,
Expand Down Expand Up @@ -794,7 +794,7 @@
"free": "#7EB26D"
},
"bars": false,
"datasource": "prometheus.default.svc.cluster.local",
"datasource": "prometheus.monitoring.svc.cluster.local",
"editable": true,
"error": false,
"fill": 1,
Expand Down Expand Up @@ -900,7 +900,7 @@
"used": "#EAB839"
},
"bars": false,
"datasource": "prometheus.default.svc.cluster.local",
"datasource": "prometheus.monitoring.svc.cluster.local",
"editable": true,
"error": false,
"fill": 7,
Expand Down Expand Up @@ -1010,7 +1010,7 @@
"used": "#EAB839"
},
"bars": false,
"datasource": "prometheus.default.svc.cluster.local",
"datasource": "prometheus.monitoring.svc.cluster.local",
"editable": true,
"error": false,
"fill": 7,
Expand Down Expand Up @@ -1122,7 +1122,7 @@
"used": "#EAB839"
},
"bars": false,
"datasource": "prometheus.default.svc.cluster.local",
"datasource": "prometheus.monitoring.svc.cluster.local",
"editable": true,
"error": false,
"fill": 7,
Expand Down Expand Up @@ -1267,7 +1267,7 @@
"text": "10.35.140.5",
"value": "10.35.140.5"
},
"datasource": "prometheus.default.svc.cluster.local",
"datasource": "prometheus.monitoring.svc.cluster.local",
"hide": 1,
"hideLabel": true,
"includeAll": false,
Expand Down Expand Up @@ -1309,7 +1309,7 @@
"text": "All",
"value": "$__all"
},
"datasource": "prometheus.default.svc.cluster.local",
"datasource": "prometheus.monitoring.svc.cluster.local",
"hide": 2,
"hideVariable": true,
"includeAll": true,
Expand Down
9 changes: 8 additions & 1 deletion definitions/init.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

GRAFANA_VERSION=3.1.1
PROMETHEUS_VERSION=v1.2.1
PROMETHEUS_VERSION=v1.3.1
DOCKER_USER=camil
RED='\033[0;31m'
GREEN='\033[0;32m'
Expand Down Expand Up @@ -172,6 +172,13 @@ kubectl create -f ./k8s/prometheus

echo

#deploy kube-state-metrics
echo -e "${ORANGE}Deploying Kube State Metrics exporter"
tput sgr0
kubectl create -f ./k8s/kube-state-metrics

echo

#deploy ingress controller
echo -e "${BLUE}Deploying K8S Ingress Controller"
tput sgr0
Expand Down
19 changes: 19 additions & 0 deletions definitions/k8s/kube-state-metrics/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: kube-state-metrics-deployment
namespace: monitoring
spec:
replicas: 1
template:
metadata:
labels:
app: kube-state-metrics
version: "v0.3.0"
spec:
containers:
- name: kube-state-metrics
image: gcr.io/google_containers/kube-state-metrics:v0.3.0
ports:
- containerPort: 8080
imagePullPolicy: Always
16 changes: 16 additions & 0 deletions definitions/k8s/kube-state-metrics/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
annotations:
prometheus.io/scrape: 'true'
name: kube-state-metrics
namespace: monitoring
labels:
app: kube-state-metrics
spec:
ports:
- name: kube-state-metrics
port: 8080
protocol: TCP
selector:
app: kube-state-metrics
2 changes: 1 addition & 1 deletion definitions/k8s/prometheus/02-prometheus.svc.petset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
terminationGracePeriodSeconds: 0
containers:
- name: prometheus-prom-1
image: prom/prometheus:v1.3.0
image: prom/prometheus:v1.3.1
args:
- '-storage.local.retention=720h'
- '-storage.local.memory-chunks=500000'
Expand Down
1 change: 1 addition & 0 deletions definitions/remove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
kubectl delete -f ./k8s/grafana
kubectl delete -f ./k8s/ingress
kubectl delete -f ./k8s/prometheus
kubectl delete -f ./k8s/kube-state-metrics
kubectl delete secret dhparam -n monitoring

0 comments on commit bc0551a

Please sign in to comment.