kubernetes-yaml/learn/learn-kubernetes-master/kiamol/ch14/lab/monitoring/prometheus.yaml

71 lines
1.5 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: prometheus
namespace: kiamol-ch14-lab-monitoring
spec:
selector:
matchLabels:
app: prometheus
template:
metadata:
labels:
app: prometheus
spec:
serviceAccountName: prometheus
containers:
- name: prometheus
image: prom/prometheus:v2.19.2
args:
- "--config.file=/config/prometheus.yml"
- "--web.enable-lifecycle"
ports:
- containerPort: 9090
volumeMounts:
- name: prometheus-config
mountPath: /config/
volumes:
- name: prometheus-config
configMap:
name: prometheus-config
---
# RBAC configuration - ignore this until we get to chapter 17 :)
apiVersion: v1
kind: ServiceAccount
metadata:
name: prometheus
namespace: kiamol-ch14-lab-monitoring
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: prometheus
labels:
kiamol: ch14
rules:
- apiGroups: [""]
resources:
- nodes
- services
- endpoints
- pods
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources:
- configmaps
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: prometheus
labels:
kiamol: ch14
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: prometheus
subjects:
- kind: ServiceAccount
name: prometheus
namespace: kiamol-ch14-lab-monitoring