kube-prometheus-stack
kube-prometheus-stack is a collection of Kubernetes manifests including the follow
- Prometheus operator
- Prometheus
- Alertmanager
- Prometheus node-exporter
- Prometheus Adapter
- kube-state-metrics
- Grafana
- pre-configured to collect metrics from all Kubernetes component
- delivers a default set of dashboards and alerting rules
Prerequiste
- Kubernetes
- Helm
Install
$ helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
$ kubectl create ns prom
$ helm install prometheus prometheus-community/kube-prometheus-stack -n prom
$ kubectl get all -n prom
NAME READY STATUS RESTARTS AGE
pod/alertmanager-prom-kube-prometheus-stack-alertmanager-0 2/2 Running 0 2m14s
pod/prom-grafana-6c578f9954-jd4nc 2/2 Running 0 2m15s
pod/prom-kube-prometheus-stack-operator-598f86d8d7-759tf 1/1 Running 0 2m15s
pod/prom-kube-state-metrics-85d7ddf577-bmnzz 1/1 Running 0 2m15s
pod/prom-prometheus-node-exporter-6kf8n 1/1 Running 0 2m16s
pod/prometheus-prom-kube-prometheus-stack-prometheus-0 2/2 Running 1 2m13s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/alertmanager-operated ClusterIP None <none> 9093/TCP,9094/TCP,9094/UDP 2m14s
service/prom-grafana ClusterIP 10.107.46.206 <none> 80/TCP 2m16s
service/prom-kube-prometheus-stack-alertmanager ClusterIP 10.107.9.211 <none> 9093/TCP 2m16s
service/prom-kube-prometheus-stack-operator ClusterIP 10.104.10.237 <none> 443/TCP 2m16s
service/prom-kube-prometheus-stack-prometheus ClusterIP 10.110.117.167 <none> 9090/TCP 2m16s
service/prom-kube-state-metrics ClusterIP 10.106.62.213 <none> 8080/TCP 2m16s
service/prom-prometheus-node-exporter ClusterIP 10.96.109.34 <none> 9100/TCP 2m16s
service/prometheus-operated ClusterIP None <none> 9090/TCP 2m13s
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
daemonset.apps/prom-prometheus-node-exporter 1 1 1 1 1 <none> 2m16s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/prom-grafana 1/1 1 1 2m16s
deployment.apps/prom-kube-prometheus-stack-operator 1/1 1 1 2m16s
deployment.apps/prom-kube-state-metrics 1/1 1 1 2m16s
NAME DESIRED CURRENT READY AGE
replicaset.apps/prom-grafana-6c578f9954 1 1 1 2m16s
replicaset.apps/prom-kube-prometheus-stack-operator-598f86d8d7 1 1 1 2m16s
replicaset.apps/prom-kube-state-metrics-85d7ddf577 1 1 1 2m16s
NAME READY AGE
statefulset.apps/alertmanager-prom-kube-prometheus-stack-alertmanager 1/1 2m14s
statefulset.apps/prometheus-prom-kube-prometheus-stack-prometheus 1/1 2m13s
Access Prometheus Dashboard
All services are defined as ClusterIP in default configuration. To access, we are going to use port-forward. However we can edit the service or edit the value upon deployment to use NodePort or Ingress.
$ kubectl port-forward -n prom prometheus-prom-kube-prometheus-stack-prometheus-0 9090
Access Grafana Dashboard
- default user/password is admin/prom-operator
$ kubectl port-forward -n prom prom-grafana-6c578f9954-rjdmk 3000
Uninstall
$ helm uninstall prom -n prom
Remove CRDs
$ kubectl delete crd alertmanagerconfigs.monitoring.coreos.com
$ kubectl delete crd alertmanagers.monitoring.coreos.com
$ kubectl delete crd podmonitors.monitoring.coreos.com
$ kubectl delete crd probes.monitoring.coreos.com
$ kubectl delete crd prometheuses.monitoring.coreos.com
$ kubectl delete crd prometheusrules.monitoring.coreos.com
$ kubectl delete crd servicemonitors.monitoring.coreos.com
$ kubectl delete crd thanosrulers.monitoring.coreos.com
Discussion (1)
be sure to update your helm charts before installing