Search code examples
kubernetesprometheus-operator

What is the difference between the core os projects kube-prometheus and prometheus operator?


The github repo of Prometheus Operator https://github.com/coreos/prometheus-operator/ project says that

The Prometheus Operator makes the Prometheus configuration Kubernetes native and manages and operates Prometheus and Alertmanager clusters. It is a piece of the puzzle regarding full end-to-end monitoring.

kube-prometheus combines the Prometheus Operator with a collection of manifests to help getting started with monitoring Kubernetes itself and applications running on top of it.

Can someone elaborate this?


Solution

  • I've always had this exact same question/repeatedly bumped into both, but tbh reading the above answer didn't clarify it for me/I needed a short explanation. I found this github issue that just made it crystal clear to me. https://github.com/coreos/prometheus-operator/issues/2619

    Quoting nicgirault of GitHub:

    At last I realized that prometheus-operator chart was packaging kube-prometheus stack but it took me around 10 hours playing around to realize this.

    Here's my summarized explanation:
    "kube-prometheus" and "Prometheus Operator Helm Chart" both do the same thing:

    1. Basically the Ingress/Ingress Controller Concept, applied to Metrics/Prometheus Operator.
    2. Both are a means of easily configuring, installing, and managing a huge distributed application (Kubernetes Prometheus Stack) on Kubernetes:

      What is the Entire Kube Prometheus Stack you ask?
      Prometheus, Grafana, AlertManager, CRDs (Custom Resource Definitions), Prometheus Operator(software bot app), IaC Alert Rules, IaC Grafana Dashboards, IaC ServiceMonitor CRDs (which auto-generate Prometheus Metric Collection Configuration and auto hot import it into Prometheus Server)
      (Also when I say easily configuring I mean 1,000-10,000++ lines of easy for humans to understand config that generates and auto manage 10,000-100,000 lines of machine config + stuff with sensible defaults + monitoring configuration self-service, distributed configuration sharding with an operator/controller to combine config + generate verbose boilerplate machine-readable config from nice human-readable config.

    If they achieve the same end goal, you might ask what's the difference between them?
    https://github.com/coreos/kube-prometheus
    https://github.com/helm/charts/tree/master/stable/prometheus-operator
    Basically, CoreOS's kube-prometheus deploys the Prometheus Stack using Ksonnet.
    Prometheus Operator Helm Chart wraps kube-prometheus / achieves the same end result but with Helm.

    So which one to use?
    Doesn't matter + they achieve the same end result + shouldn't be crazy difficult to start with 1 and switch to the other.

    Helm tends to be faster to learn/develop basic mastery of.

    Ksonnet is harder to learn/develop basic mastery of, but:

    • it's more idempotent (better for CICD automation) (but it's only a difference of 99% idempotent vs 99.99% idempotent.)
    • has built-in templating which means that if you have multiple clusters you need to manage / that you want to always keep consistent with each other. Then you can leverage ksonnet's templating to manage multiple instances of the Kube Prometheus Stack (for multiple envs) using a DRY code base with lots of code reuse. (If you only have a few envs and Prometheus doesn't need to change often it's not completely unreasonable to keep 4 helm values files in sync by hand. I've also seen Jinja2 templating used to template out helm values files, but if you're going to bother with that you may as well just consider ksonnet.)