Skip to content

Commit

Permalink
Add config.rb and extra addon: Grafana
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Lenne committed Nov 23, 2016
1 parent 59e2cbb commit c843450
Show file tree
Hide file tree
Showing 10 changed files with 168 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.vagrant
config.rb
admin.conf
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ weave-net-ph7l3 2/2 Running 0 1h
- weave-net
- dashboard

## Extra plugins
- Grafana + InfluxDB (must be activated in config.rb)

## Prerequisites
- Vagrant 1.8 (with NFS support)

Expand Down Expand Up @@ -54,6 +57,8 @@ $master_memory = 1536
$worker_count = 2
# Total memory of nodes
$worker_memory = 1536
# Add Grafana with InfluxDB (work with heapster)
$grafana = false
```

### Basic usage
Expand Down
4 changes: 4 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
s.inline = "sh /vagrant/install.sh $1 $2 $3 $4"
if i == $worker_count
s.args = ["-node", "#{ip}", "-last", "#{$token}"]
#EXTRA ADDONS
if $grafana
node.vm.provision :shell, :inline => "kubectl --kubeconfig /shared/admin.conf apply -f /vagrant/influxdb/"
end
else
s.args = ["-node", "#{ip}", "none", "#{$token}"]
end
Expand Down
10 changes: 10 additions & 0 deletions config.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# If you change, Keep the structure with the dot. [0-9 a-f]
$token = "56225f.9096af3559800a6a"
# Total memory of master
$master_memory = 1536
# Increment to have more nodes
$worker_count = 2
# Total memory of nodes
$worker_memory = 1536
# Add Grafana with InfluxDB (work with heapster)
$grafana = false
43 changes: 43 additions & 0 deletions influxdb/grafana-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: monitoring-grafana
namespace: kube-system
spec:
replicas: 1
template:
metadata:
labels:
task: monitoring
k8s-app: grafana
spec:
volumes:
- name: grafana-storage
emptyDir: {}
containers:
- name: grafana
image: gcr.io/google_containers/heapster_grafana:v3.1.1
ports:
- containerPort: 3000
protocol: TCP
volumeMounts:
- mountPath: /var
name: grafana-storage
env:
- name: INFLUXDB_HOST
value: monitoring-influxdb
- name: GRAFANA_PORT
value: "3000"
# The following env variables are required to make Grafana accessible via
# the kubernetes api-server proxy. On production clusters, we recommend
# removing these env variables, setup auth for grafana, and expose the grafana
# service using a LoadBalancer or a public IP.
- name: GF_AUTH_BASIC_ENABLED
value: "false"
- name: GF_AUTH_ANONYMOUS_ENABLED
value: "true"
- name: GF_AUTH_ANONYMOUS_ORG_ROLE
value: Admin
- name: GF_SERVER_ROOT_URL
value: /api/v1/proxy/namespaces/kube-system/services/monitoring-grafana/
#value: /
20 changes: 20 additions & 0 deletions influxdb/grafana-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v1
kind: Service
metadata:
labels:
# For use as a Cluster add-on (https://github.com/kubernetes/kubernetes/tree/master/cluster/addons)
# If you are NOT using this as an addon, you should comment out this line.
kubernetes.io/cluster-service: 'true'
kubernetes.io/name: monitoring-grafana
name: monitoring-grafana
namespace: kube-system
spec:
# In a production setup, we recommend accessing Grafana through an external Loadbalancer
# or through a public IP.
# type: LoadBalancer
type: NodePort
ports:
- port: 80
targetPort: 3000
selector:
k8s-app: grafana
22 changes: 22 additions & 0 deletions influxdb/heapster-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: heapster
namespace: kube-system
spec:
replicas: 1
template:
metadata:
labels:
task: monitoring
k8s-app: heapster
version: v6
spec:
containers:
- name: heapster
image: gcr.io/google_containers/heapster:v1.2.0
imagePullPolicy: Always
command:
- /heapster
- --source=kubernetes:https://kubernetes.default
- --sink=influxdb:http://monitoring-influxdb:8086
17 changes: 17 additions & 0 deletions influxdb/heapster-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
labels:
task: monitoring
# For use as a Cluster add-on (https://github.com/kubernetes/kubernetes/tree/master/cluster/addons)
# If you are NOT using this as an addon, you should comment out this line.
kubernetes.io/cluster-service: 'true'
kubernetes.io/name: Heapster
name: heapster
namespace: kube-system
spec:
ports:
- port: 80
targetPort: 8082
selector:
k8s-app: heapster
22 changes: 22 additions & 0 deletions influxdb/influxdb-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: monitoring-influxdb
namespace: kube-system
spec:
replicas: 1
template:
metadata:
labels:
task: monitoring
k8s-app: influxdb
spec:
volumes:
- name: influxdb-storage
emptyDir: {}
containers:
- name: influxdb
image: kubernetes/heapster_influxdb:v0.6
volumeMounts:
- mountPath: /data
name: influxdb-storage
24 changes: 24 additions & 0 deletions influxdb/influxdb-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v1
kind: Service
metadata:
labels:
task: monitoring
# For use as a Cluster add-on (https://github.com/kubernetes/kubernetes/tree/master/cluster/addons)
# If you are NOT using this as an addon, you should comment out this line.
kubernetes.io/cluster-service: 'true'
kubernetes.io/name: monitoring-influxdb
name: monitoring-influxdb
namespace: kube-system
spec:
# InfluxDB has a UI that can be used to query, uncomment the `http` port and expose
# to access this service.
# type: NodePort
ports:
# - name: http
# port: 80
# targetPort: 8083
- name: api
port: 8086
targetPort: 8086
selector:
k8s-app: influxdb

0 comments on commit c843450

Please sign in to comment.