-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontiv-prometheus.yml
85 lines (85 loc) · 1.89 KB
/
contiv-prometheus.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Gives Prometheus permission to share the cluster
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: prometheus
namespace: kube-system
rules:
- apiGroups: [""]
resources:
- pods
verbs: ["get", "list", "watch"]
- nonResourceURLs: ["/metrics"]
verbs: ["get"]
---
# Prometheus is a process and hence needs service account access
apiVersion: v1
kind: ServiceAccount
metadata:
name: prometheus
namespace: kube-system
# Binds Prometheus to the kube-system namespace
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: prometheus
namespace: kube-system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: prometheus
subjects:
- kind: ServiceAccount
name: prometheus
namespace: kube-system
# Deploy prometheus as a replicaset with one container
---
apiVersion: extensions/v1beta1
kind: ReplicaSet
metadata:
name: contiv-prometheus
namespace: kube-system
labels:
k8s-app: contiv-prometheus
spec:
replicas: 1
template:
metadata:
name: contiv-prometheus
labels:
k8s-app: contiv-prometheus
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
spec:
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
nodeSelector:
node-role.kubernetes.io/master: ""
containers:
- name: contiv-prometheus
image: prom/prometheus
volumeMounts:
- mountPath: /etc/prometheus
name: var-contiv
volumes:
- name: var-contiv
hostPath:
path: /var/contiv
serviceAccountName: prometheus
# Expose prometheus as a service
---
apiVersion: v1
kind: Service
metadata:
name: prometheus
namespace: kube-system
spec:
type: NodePort
selector:
k8s-app: contiv-prometheus
ports:
- protocol: TCP
port: 9090
nodePort: 32700