Prometheus Installation with Prometheus Operator

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

External

Internal

Overview

Incomplete. I installed the operator then I did not know what to do with it.

Installation

Go to https://github.com/prometheus-operator/prometheus-operator, locate the latest release (Tags → v0.42.1) and download bundle.yaml.

https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.42.1/bundle.yaml

If deploying in a namespace other than the default namespace, adjust the namespace in:

  • ClusterRoleBinding (ServiceAccount)
  • Deployment
  • ServiceAccount
  • Service
kubectl -n prometheus apply -f bundle.yaml

customresourcedefinition.apiextensions.k8s.io/alertmanagers.monitoring.coreos.com created
customresourcedefinition.apiextensions.k8s.io/podmonitors.monitoring.coreos.com created
customresourcedefinition.apiextensions.k8s.io/probes.monitoring.coreos.com created
customresourcedefinition.apiextensions.k8s.io/prometheuses.monitoring.coreos.com created
customresourcedefinition.apiextensions.k8s.io/prometheusrules.monitoring.coreos.com created
customresourcedefinition.apiextensions.k8s.io/servicemonitors.monitoring.coreos.com created
customresourcedefinition.apiextensions.k8s.io/thanosrulers.monitoring.coreos.com created
clusterrolebinding.rbac.authorization.k8s.io/prometheus-operator created
clusterrole.rbac.authorization.k8s.io/prometheus-operator created
deployment.apps/prometheus-operator created
serviceaccount/prometheus-operator created
service/prometheus-operator created

Removal

for n in $(kubectl get namespaces -o jsonpath={..metadata.name}); do
  kubectl delete --all --namespace=$n prometheus,servicemonitor,podmonitor,alertmanager
done
kubectl delete -f bundle.yaml