instruction: How do you set up a complete Prometheus monitoring stack?
output: GitHub - prometheus-operator/prometheus-operator: Prometheus Operator creates/configures/manages Prometheus clusters atop Kubernetes Skip to content Navigation Menu Toggle navigation Sign in Appearance settings Product GitHub Copilot Write better code with AI GitHub Spark New Build and deploy intelligent apps GitHub Models New Manage and compare prompts GitHub Advanced Security Find and fix vulnerabilities Actions Automate any workflow Codespaces Instant dev environments Issues Plan and track work Code Review Manage code changes Discussions Collaborate outside of code Code Search Find more, search less Explore Why GitHub All features Documentation GitHub Skills Blog Solutions By company size Enterprises Small and medium teams Startups Nonprofits By use case DevSecOps DevOps CI/CD View all use cases By industry Healthcare Financial services Manufacturing Government View all industries View all solutions Resources Topics AI DevOps Security Software Development View all Explore Learning Pathways Events &amp; Webinars Ebooks &amp; Whitepapers Customer Stories Partners Executive Insights Open Source GitHub Sponsors Fund open source developers The ReadME Project GitHub community articles Repositories Topics Trending Collections Enterprise Enterprise platform AI-powered developer platform Available add-ons GitHub Advanced Security Enterprise-grade security features Copilot for business Enterprise-grade AI features Premium Support Enterprise-grade 24/7 support Pricing Search or jump to... Search code, repositories, users, issues, pull requests... --> Search Clear Search syntax tips Provide feedback --> We read every piece of feedback, and take your input very seriously. Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly --> Name Query To see all available qualifiers, see our documentation . Cancel Create saved search Sign in Sign up Appearance settings Resetting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} prometheus-operator / prometheus-operator Public Notifications You must be signed in to change notification settings Fork 3.8k Star 9.6k Prometheus Operator creates/configures/manages Prometheus clusters atop Kubernetes prometheus-operator.dev License Apache-2.0 license 9.6k stars 3.8k forks Branches Tags Activity Star Notifications You must be signed in to change notification settings Code Issues 196 Pull requests 60 Discussions Actions Projects 1 Security Uh oh! There was an error while loading. Please reload this page . Insights Additional navigation options Code Issues Pull requests Discussions Actions Projects Security Insights prometheus-operator/prometheus-operator main Branches Tags Go to file Code Open more actions menu Folders and files Name Name Last commit message Last commit date Latest commit History 7,907 Commits .github .github Documentation Documentation cmd cmd contrib/ kube-prometheus contrib/ kube-prometheus example example helm helm internal internal jsonnet jsonnet pkg pkg scripts scripts test test .editorconfig .editorconfig .gitattributes .gitattributes .gitignore .gitignore .golangci.yml .golangci.yml .header .header .mdox.validate.yaml .mdox.validate.yaml ADOPTERS.md ADOPTERS.md CHANGELOG.md CHANGELOG.md CNAME CNAME CONTRIBUTING.md CONTRIBUTING.md DCO DCO Dockerfile Dockerfile LICENSE LICENSE MAINTAINERS.md MAINTAINERS.md Makefile Makefile NOTICE NOTICE README.md README.md RELEASE.md RELEASE.md SECURITY.md SECURITY.md TESTING.md TESTING.md VERSION VERSION bundle.yaml bundle.yaml code-of-conduct.md code-of-conduct.md go.mod go.mod go.sum go.sum governance.md governance.md kustomization.yaml kustomization.yaml View all files Repository files navigation README Code of conduct Contributing Apache-2.0 license Security Prometheus Operator Overview The Prometheus Operator provides Kubernetes native deployment and management of Prometheus and related monitoring components. The purpose of this project is to simplify and automate the configuration of a Prometheus based monitoring stack for Kubernetes clusters. The Prometheus operator includes, but is not limited to, the following features: Kubernetes Custom Resources : Use Kubernetes custom resources to deploy and manage Prometheus, Alertmanager, and related components. Simplified Deployment Configuration : Configure the fundamentals of Prometheus like versions, persistence, retention policies, and replicas from a native Kubernetes resource. Prometheus Target Configuration : Automatically generate monitoring target configurations based on familiar Kubernetes label queries; no need to learn a Prometheus specific configuration language. For an introduction to the Prometheus Operator, see the getting started guide. Project Status The operator in itself is considered to be production ready. Please refer to the Custom Resource Definition (CRD) versions for the status of each CRD: monitoring.coreos.com/v1 : stable CRDs and API, changes are made in a backward-compatible way. monitoring.coreos.com/v1beta1 : unstable CRDs and API, changes can happen but the team is focused on avoiding them. We encourage usage in production for users that accept the risk of breaking changes. monitoring.coreos.com/v1alpha1 : unstable CRDs and API, changes can happen frequently, and we suggest avoiding its usage on mission-critical environments. Prometheus Operator vs. kube-prometheus vs. community Helm chart Prometheus Operator The Prometheus Operator uses Kubernetes custom resources to simplify the deployment and configuration of Prometheus, Alertmanager, and related monitoring components. kube-prometheus kube-prometheus provides example configurations for a complete cluster monitoring stack based on Prometheus and the Prometheus Operator. This includes deployment of multiple Prometheus and Alertmanager instances, metrics exporters such as the node_exporter for gathering node metrics, scrape target configuration linking Prometheus to various metrics endpoints, and example alerting rules for notification of potential issues in the cluster. Helm chart The prometheus-community/kube-prometheus-stack Helm chart provides a similar feature set to kube-prometheus. This chart is maintained by the Prometheus community. For more information, please see the chart's readme Prerequisites The Prometheus Operator requires at least Kubernetes version 1.16.0 . If you are just starting out with the Prometheus Operator, it is highly recommended to use the latest stable release . CustomResourceDefinitions A core feature of the Prometheus Operator is to monitor the Kubernetes API server for changes to specific objects and ensure that the current Prometheus deployments match these objects. The Operator acts on the following Custom Resource Definitions (CRDs) : Prometheus , which defines a desired Prometheus deployment. PrometheusAgent , which defines a desired Prometheus deployment, but running in Agent mode. Alertmanager , which defines a desired Alertmanager deployment. ThanosRuler , which defines a desired Thanos Ruler deployment. ServiceMonitor , which declaratively specifies how groups of Kubernetes services should be monitored. The Operator automatically generates Prometheus scrape configuration based on the current state of the objects in the API server. PodMonitor , which declaratively specifies how group of pods should be monitored. The Operator automatically generates Prometheus scrape configuration based on the current state of the objects in the API server. Probe , which declaratively specifies how groups of ingresses or static targets should be monitored. The Operator automatically generates Prometheus scrape configuration based on the definition. ScrapeConfig , which declaratively specifies scrape configurations to be added to Prometheus. This CustomResourceDefinition helps with scraping resources outside the Kubernetes cluster. PrometheusRule , which defines a desired set of Prometheus alerting and/or recording rules. The Operator generates a rule file, which can be used by Prometheus instances. AlertmanagerConfig , which declaratively specifies subsections of the Alertmanager configuration, allowing routing of alerts to custom receivers, and setting inhibit rules. The Prometheus operator automatically detects changes in the Kubernetes API server to any of the above objects, and ensures that matching deployments and configurations are kept in sync. To learn more about the CRDs introduced by the Prometheus Operator have a look at the design page. Dynamic Admission Control To prevent invalid Prometheus alerting and recording rules from causing failures in a deployed Prometheus instance, an admission webhook is provided to validate PrometheusRule resources upon initial creation or update. For more information on this feature, see the user guide . Quickstart Note: this quickstart does not provision an entire monitoring stack; if that is what you are looking for, see the kube-prometheus project. If you want the whole stack, but have already applied the bundle.yaml , delete the bundle first ( kubectl delete -f bundle.yaml ). To quickly try out just the Prometheus Operator inside a cluster, choose a release and run the following command which deploys the operator in the default namespace: kubectl create -f bundle.yaml If you want to deploy the Prometheus operator in a different namespace, you also need kustomize : NAMESPACE=my_namespace kustomize edit set namespace $NAMESPACE &amp;&amp; kubectl create -k . Note: make sure to adapt the namespace in the ClusterRoleBinding if deploying in a namespace other than the default namespace. To run the Operator outside of a cluster: make scripts/run-external.sh &lt; kubectl cluster name &gt; Removal To remove the operator and Prometheus, first delete any custom resources you created in each namespace. The operator will automatically shut down and remove Prometheus and Alertmanager pods, and associated ConfigMaps. for n in $( kubectl get namespaces -o jsonpath={..metadata.name} ) ; do kubectl delete --all --namespace= $n prometheus,servicemonitor,podmonitor,alertmanager done After a couple of minutes you can go ahead and remove the operator itself. kubectl delete -f bundle.yaml The operator automatically creates services in each namespace where you created a Prometheus or Alertmanager resources, and defines three custom resource definitions. You can clean these up now. for n in $( kubectl get namespaces -o jsonpath={..metadata.name} ) ; do kubectl delete --ignore-not-found --namespace= $n service prometheus-operated alertmanager-operated done kubectl delete --ignore-not-found customresourcedefinitions \ prometheuses.monitoring.coreos.com \ servicemonitors.monitoring.coreos.com \ podmonitors.monitoring.coreos.com \ alertmanagers.monitoring.coreos.com \ prometheusrules.monitoring.coreos.com \ alertmanagerconfigs.monitoring.coreos.com \ scrapeconfigs.monitoring.coreos.com Testing See TESTING Contributing See CONTRIBUTING . Security If you find a security vulnerability related to the Prometheus Operator, please do not report it by opening a GitHub issue, but instead please send an e-mail to the maintainers of the project found in the MAINTAINERS.md file. Troubleshooting Check the troubleshooting documentation for common issues and frequently asked questions (FAQ). Acknowledgements prometheus-operator organization logo was created and contributed by Bianca Cheng Costanzo . About Prometheus Operator creates/configures/manages Prometheus clusters atop Kubernetes prometheus-operator.dev Topics kubernetes monitoring prometheus hacktoberfest Resources Readme License Apache-2.0 license Code of conduct Code of conduct Contributing Contributing Security policy Security policy Uh oh! There was an error while loading. Please reload this page . Activity Custom properties Stars 9.6k stars Watchers 146 watching Forks 3.8k forks Report repository Releases 154 0.84.1 / 2025-08-06 Latest Aug 6, 2025 + 153 releases Packages 0 &nbsp; &nbsp; &nbsp; Uh oh! There was an error while loading. Please reload this page . Used by 180 + 172 Contributors 636 + 622 contributors Languages Go 82.1% Jsonnet 16.9% Other 1.0% Footer &copy; 2025 GitHub,&nbsp;Inc. Footer navigation Terms Privacy Security Status Docs Contact Manage cookies Do not share my personal information You can’t perform that action at this time.