{"id":3695,"date":"2023-07-30T09:30:51","date_gmt":"2023-07-30T06:30:51","guid":{"rendered":"https:\/\/www.virtono.com\/community\/?p=3695"},"modified":"2023-07-28T09:34:47","modified_gmt":"2023-07-28T06:34:47","slug":"how-to-deploy-prometheus-on-kubernetes","status":"publish","type":"post","link":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-prometheus-on-kubernetes\/","title":{"rendered":"How to Deploy Prometheus on Kubernetes"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" data-attachment-id=\"3703\" data-permalink=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-prometheus-on-kubernetes\/attachment\/deploy-prometheus-on-kubernetes-png\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Deploy-Prometheus-on-Kubernetes.png.png?fit=1920%2C1080&amp;ssl=1\" data-orig-size=\"1920,1080\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Deploy-Prometheus-on-Kubernetes.png\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Deploy-Prometheus-on-Kubernetes.png.png?fit=750%2C422&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Deploy-Prometheus-on-Kubernetes.png.png?resize=750%2C422&#038;ssl=1\" alt=\"How to Deploy Prometheus on Kubernetes\" class=\"wp-image-3703\" srcset=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Deploy-Prometheus-on-Kubernetes.png.png?resize=1024%2C576&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Deploy-Prometheus-on-Kubernetes.png.png?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Deploy-Prometheus-on-Kubernetes.png.png?resize=768%2C432&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Deploy-Prometheus-on-Kubernetes.png.png?resize=1536%2C864&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Deploy-Prometheus-on-Kubernetes.png.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p>In this tutorial, we&#8217;ll discuss how to set up <a href=\"https:\/\/prometheus.io\/\" target=\"_blank\" rel=\"noopener\">Prometheus<\/a> on Kubernetes. We&#8217;ll assume that you&#8217;ve already installed Helm and K3s. If you don&#8217;t have K3s and Helm installed you can <a href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-k3s-cluster-and-helm\/\">follow our guide.<\/a> Prometheus has established itself as a top open-source option for monitoring and alerting systems. It is renowned for its multi-dimensional data model with time series data identified by metric name and key\/value pairs, flexible query language, and integration with many well-liked graphing and dashboarding solutions.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_73 counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-prometheus-on-kubernetes\/#Introduction\" title=\"Introduction\">Introduction<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-prometheus-on-kubernetes\/#Getting_Your_Environment_Ready\" title=\"Getting Your Environment Ready\">Getting Your Environment Ready<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-prometheus-on-kubernetes\/#Deploy_Prometheus_on_Kubernetes\" title=\"Deploy Prometheus on Kubernetes\">Deploy Prometheus on Kubernetes<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-prometheus-on-kubernetes\/#Create_a_Prometheus_Configuration_File\" title=\"Create a Prometheus Configuration File\">Create a Prometheus Configuration File<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-prometheus-on-kubernetes\/#Configuring_Prometheus_on_Kubernetes\" title=\"Configuring Prometheus on Kubernetes\">Configuring Prometheus on Kubernetes<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-prometheus-on-kubernetes\/#Verifying_the_Deployment\" title=\"Verifying the Deployment\">Verifying the Deployment<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-prometheus-on-kubernetes\/#Monitoring_Your_K3s_Cluster\" title=\"Monitoring Your K3s Cluster\">Monitoring Your K3s Cluster<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-prometheus-on-kubernetes\/#Final_Thoughts\" title=\"Final Thoughts\">Final Thoughts<\/a><\/li><\/ul><\/nav><\/div>\n<h3 class=\"wp-block-heading has-accent-color has-text-color\"><span class=\"ez-toc-section\" id=\"Introduction\"><\/span>Introduction<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Due to its powerful features and usability, Prometheus has established itself as a go-to solution for many organizations. You can build a strong platform for monitoring your applications and systems by combining it with K3s, a Kubernetes distribution that is incredibly effective and streamlined.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-accent-color has-text-color\"><span class=\"ez-toc-section\" id=\"Getting_Your_Environment_Ready\"><\/span>Getting Your Environment Ready<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>It&#8217;s important to confirm that your environment is properly configured before we start the installation process of Prometheus on Kubernetes. We won&#8217;t do <a href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-k3s-cluster-and-helm\/\">K3s and Helm installation<\/a> because we&#8217;ll assume that they are already installed.<\/p>\n\n\n\n<p>You must ensure that Helm is installed and updated to the most recent version and that the K3s cluster is operational. Run <strong>kubectl get nodes<\/strong> to verify the K3s cluster, and <strong>helm version<\/strong> to verify Helm.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"179\" data-attachment-id=\"3696\" data-permalink=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-prometheus-on-kubernetes\/attachment\/screenshot-2023-07-27-at-16-18-18\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.18.18.png?fit=2274%2C542&amp;ssl=1\" data-orig-size=\"2274,542\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot-2023-07-27-at-16.18.18\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.18.18.png?fit=750%2C179&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.18.18.png?resize=750%2C179&#038;ssl=1\" alt=\"How to Deploy Prometheus on Kubernetes\" class=\"wp-image-3696\" srcset=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.18.18.png?resize=1024%2C244&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.18.18.png?resize=300%2C72&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.18.18.png?resize=768%2C183&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.18.18.png?resize=1536%2C366&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.18.18.png?resize=2048%2C488&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.18.18.png?w=2250&amp;ssl=1 2250w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading has-accent-color has-text-color\"><span class=\"ez-toc-section\" id=\"Deploy_Prometheus_on_Kubernetes\"><\/span>Deploy Prometheus on Kubernetes<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The Prometheus Operator is an open-source project that enables quick monitoring definitions for Kubernetes services as well as the deployment and administration of Prometheus instances.<\/p>\n\n\n\n<p>First, add the Prometheus community Helm charts by executing the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>helm repo add prometheus-community https:\/\/prometheus-community.github.io\/helm-charts<\/code><\/pre>\n\n\n\n<p>Next, update the Helm repository:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>helm repo update<\/code><\/pre>\n\n\n\n<p>Now, create a namespace for Prometheus:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>kubectl create namespace prometheus<\/code><\/pre>\n\n\n\n<p>Finally, install the Prometheus Operator:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>helm install prometheus prometheus-community\/kube-prometheus-stack --namespace prometheus<\/code><\/pre>\n\n\n\n<p>This command will install the Prometheus Operator in the &#8216;prometheus&#8217; namespace.<\/p>\n\n\n\n<h4 class=\"wp-block-heading has-accent-color has-text-color\"><span class=\"ez-toc-section\" id=\"Create_a_Prometheus_Configuration_File\"><\/span><strong>Create a Prometheus Configuration File<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>To specify your Prometheus on Kubernetes instance, Service, and ServiceMonitor, you must create a configuration file (prometheus.yaml). Here is an easy illustration:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>apiVersion: monitoring.coreos.com\/v1\nkind: Prometheus\nmetadata:\n  name: prometheus\n  namespace: prometheus\nspec:\n  serviceAccountName: prometheus\n  serviceMonitorSelector:\n    matchLabels:\n      team: frontend\n  resources:\n    requests:\n      memory: 400Mi\n  enableAdminAPI: false\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: prometheus\n  namespace: prometheus\nspec:\n  selector:\n    prometheus: prometheus\n  type: NodePort\n  ports:\n    - name: web\n      port: 9090\n      targetPort: web\n      nodePort: 30900\n---\napiVersion: monitoring.coreos.com\/v1\nkind: ServiceMonitor\nmetadata:\n  name: k3s\n  labels:\n    team: frontend\nspec:\n  selector:\n    matchLabels:\n      app: k3s\n  endpoints:\n  - port: web\n    interval: 15s<\/code><\/pre>\n\n\n\n<p>Use&nbsp;<code>kubectl<\/code>&nbsp;to apply the configuration file and deploy Prometheus on Kubernetes:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>kubectl apply -f prometheus.yaml -n prometheus<\/code><\/pre>\n\n\n\n<p>This command will deploy Prometheus in the &#8216;prometheus&#8217; namespace using the configuration specified in the&nbsp;<code>prometheus.yaml<\/code>&nbsp;file.<\/p>\n\n\n\n<p>Once Prometheus is deployed, you can access it by using the&nbsp;<code>kubectl port-forward<\/code>&nbsp;command:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>kubectl port-forward svc\/prometheus 9090:9090 -n prometheus<\/code><\/pre>\n\n\n\n<p>Then, open your web browser and navigate to&nbsp;<code>http:\/\/localhost:9090<\/code>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"271\" data-attachment-id=\"3699\" data-permalink=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-prometheus-on-kubernetes\/attachment\/screenshot-2023-07-27-at-15-41-30\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-15.41.30.png?fit=2872%2C1038&amp;ssl=1\" data-orig-size=\"2872,1038\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot-2023-07-27-at-15.41.30\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-15.41.30.png?fit=750%2C271&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-15.41.30.png?resize=750%2C271&#038;ssl=1\" alt=\"How to Deploy Prometheus on Kubernetes\" class=\"wp-image-3699\" srcset=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-15.41.30.png?resize=1024%2C370&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-15.41.30.png?resize=300%2C108&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-15.41.30.png?resize=768%2C278&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-15.41.30.png?resize=1536%2C555&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-15.41.30.png?resize=2048%2C740&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-15.41.30.png?w=2250&amp;ssl=1 2250w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading has-accent-color has-text-color\"><span class=\"ez-toc-section\" id=\"Configuring_Prometheus_on_Kubernetes\"><\/span>Configuring Prometheus on Kubernetes<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>You must set up the Prometheus Operator to monitor your K3s cluster after installation. In order to monitor Kubernetes services, the Prometheus Operator provides a custom resource called a ServiceMonitor, which you will create to accomplish this.<\/p>\n\n\n\n<p>Here is a sample ServiceMonitor configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>apiVersion: monitoring.coreos.com\/v1\nkind: ServiceMonitor\nmetadata:\n  name: k3s\n  labels:\n    release: prometheus\nspec:\n  selector:\n    matchLabels:\n      k8s-app: kube-state-metrics\n  namespaceSelector:\n    matchNames:\n      - kube-system\n  endpoints:\n  - port: http-metrics\n    interval: 30s<\/code><\/pre>\n\n\n\n<p>Save this configuration to a file named &#8216;servicemonitor.yaml&#8217;, then apply it with <strong>kubectl apply -f servicemonitor.yaml -n prometheus<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-accent-color has-text-color\"><span class=\"ez-toc-section\" id=\"Verifying_the_Deployment\"><\/span>Verifying the Deployment<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Once Prometheus has been installed, you should make sure it is functioning properly. To begin with, make sure the Prometheus pods are operational:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>kubectl get pods -n prometheus<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"202\" data-attachment-id=\"3697\" data-permalink=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-prometheus-on-kubernetes\/attachment\/screenshot-2023-07-27-at-16-31-50\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.31.50.png?fit=1850%2C498&amp;ssl=1\" data-orig-size=\"1850,498\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot-2023-07-27-at-16.31.50\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.31.50.png?fit=750%2C202&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.31.50.png?resize=750%2C202&#038;ssl=1\" alt=\"Prometheus on Kubernetes pods\" class=\"wp-image-3697\" srcset=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.31.50.png?resize=1024%2C276&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.31.50.png?resize=300%2C81&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.31.50.png?resize=768%2C207&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.31.50.png?resize=1536%2C413&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.31.50.png?w=1850&amp;ssl=1 1850w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>You should see the Prometheus pods listed. Next, check that the Prometheus service is running:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>kubectl get service -n prometheus<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3698\" data-permalink=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-prometheus-on-kubernetes\/attachment\/screenshot-2023-07-27-at-16-40-21\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.40.21.png?fit=2132%2C588&amp;ssl=1\" data-orig-size=\"2132,588\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot-2023-07-27-at-16.40.21\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.40.21.png?fit=750%2C207&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.40.21.png?resize=750%2C206&#038;ssl=1\" alt=\"\" class=\"wp-image-3698\" width=\"750\" height=\"206\" srcset=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.40.21.png?resize=1024%2C282&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.40.21.png?resize=300%2C83&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.40.21.png?resize=768%2C212&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.40.21.png?resize=1536%2C424&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-27-at-16.40.21.png?resize=2048%2C565&amp;ssl=1 2048w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading has-accent-color has-text-color\"><span class=\"ez-toc-section\" id=\"Monitoring_Your_K3s_Cluster\"><\/span>Monitoring Your K3s Cluster<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>You can use Prometheus to monitor your K3s cluster now that it has been installed and is operational. Grafana, which is part of the kube-prometheus-stack Helm chart, allows you to create alerting rules, query your time-series data, and visualize your data.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-accent-color has-text-color\"><span class=\"ez-toc-section\" id=\"Final_Thoughts\"><\/span>Final Thoughts<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>In this guide, we walked you through the process of deploying Prometheus on Kubernetes cluster using Helm. Although the process may seem complicated at first, it becomes straightforward once you understand the steps involved. By deploying Prometheus on K3s, you can leverage a powerful and flexible monitoring solution that can help you keep a close eye on your applications and systems.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, we&#8217;ll discuss how to set up Prometheus on Kubernetes. We&#8217;ll assume that you&#8217;ve already installed Helm and K3s. If you don&#8217;t have K3s and Helm installed you can follow our guide. Prometheus has established itself as a top open-source option for monitoring and alerting systems. It is<\/p>\n","protected":false},"author":8,"featured_media":3702,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[3],"tags":[587,594,591,592,593,595,589,588,590],"class_list":["post-3695","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorial-how-to","tag-configuring-prometheus","tag-deploy-prometheus","tag-deploy-prometheus-k3s","tag-deploy-prometheus-kubernetes","tag-prometheus-configuration-file","tag-prometheus-on-k3s","tag-prometheus-on-kubernetes","tag-prometheus-operator","tag-prometheus-servicemonitor"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/How-to-Deploy-Prometheus-on-Kubernetes.png?fit=360%2C240&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7ISfL-XB","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":3761,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-grafana-on-kubernetes\/","url_meta":{"origin":3695,"position":0},"title":"How to Deploy Grafana on Kubernetes","author":"George B.","date":"August 24, 2023","format":false,"excerpt":"This article will walk you through the process of deploying Grafana on Kubernetes, specifically using k3s and Helm, and making it accessible via a NodePort on your VPS (Virtual Private Server). We'll assume you have k3s and Helm already installed. If not, please refer to their respective official documentation to\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/08\/How-to-Deploy-Grafana-on-Kubernetes.png?fit=360%2C240&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3641,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-redis-on-kubernetes\/","url_meta":{"origin":3695,"position":1},"title":"How to Deploy Redis on Kubernetes","author":"George B.","date":"July 25, 2023","format":false,"excerpt":"This article provides a detailed guide on how to install Redis on Kubernetes, covering everything from configuring the Kubernetes environment to installing and administering Redis. The demand for effective, scalable, and trustworthy data storage solutions has increased as the world transitions to microservices and containerized applications. Redis, a high-performance in-memory\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/How-to-Deploy-Redis-on-Kubernetes.png?fit=360%2C240&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1755,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/","url_meta":{"origin":3695,"position":2},"title":"How To Install and Configure Prometheus On a Linux Server","author":"Shreyash Sharma","date":"July 27, 2020","format":false,"excerpt":"Introduction Prometheus is an open-source monitoring system developed by SoundCloud. Development on Prometheus started back in 2012 when SoundCloud felt that the existing monitoring systems were proving insufficient for their needs. It uses a time-series database just like Druid, InfluxDB, Graphite. However, Prometheus is able to work on a multi-dimensional\u2026","rel":"","context":"In &quot;Knowledgebase&quot;","block_context":{"text":"Knowledgebase","link":"https:\/\/www.virtono.com\/community\/category\/knowledgebase\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/1_yz1TgEsIb9qNtmv2O-SZsg.png?fit=1200%2C675&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/1_yz1TgEsIb9qNtmv2O-SZsg.png?fit=1200%2C675&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/1_yz1TgEsIb9qNtmv2O-SZsg.png?fit=1200%2C675&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/1_yz1TgEsIb9qNtmv2O-SZsg.png?fit=1200%2C675&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/1_yz1TgEsIb9qNtmv2O-SZsg.png?fit=1200%2C675&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3459,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-prometheus-and-grafana-on-ubuntu\/","url_meta":{"origin":3695,"position":3},"title":"How to install Prometheus and Grafana on Ubuntu","author":"George B.","date":"June 6, 2023","format":false,"excerpt":"Prometheus and Grafana are powerful open-source tools used for monitoring and visualizing system metrics, making them essential components of any modern infrastructure. In this comprehensive guide, we will walk you through the step-by-step process of installing Prometheus and Grafana on an Ubuntu system. By the end of this tutorial, you'll\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/06\/How-to-install-Prometheus-and-Grafana-on-Ubuntu.png?fit=600%2C330&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/06\/How-to-install-Prometheus-and-Grafana-on-Ubuntu.png?fit=600%2C330&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/06\/How-to-install-Prometheus-and-Grafana-on-Ubuntu.png?fit=600%2C330&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3687,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-mongodb-on-kubernetes\/","url_meta":{"origin":3695,"position":4},"title":"How to Deploy MongoDB on Kubernetes","author":"George B.","date":"July 29, 2023","format":false,"excerpt":"This tutorial will walk you through installing MongoDB on Kubernetes cluster. We'll assume that you've already got K3s and Helm set up on your machine. The deployment of applications like MongoDB on Kubernetes cluster is made easier by the Kubernetes package manager Helm. Before getting too technical, it's important to\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/How-to-Deploy-MongoDB-on-Kubernetes.png?fit=360%2C240&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3717,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-influxdb-on-kubernetes\/","url_meta":{"origin":3695,"position":5},"title":"How to Deploy InfluxDB on Kubernetes","author":"George B.","date":"August 4, 2023","format":false,"excerpt":"InfluxDB has become a popular choice for time-series databases, especially for DevOps monitoring, real-time analytics, and IoT applications. In this guide, we will explore how to deploy InfluxDB on Kubernetes cluster using K3s and Helm. We will assume that you already have K3s installed and Helm configured.\u00a0If K3s and Helm\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/08\/Deploy-InfluxDB-on-Kubernetes.png?fit=360%2C240&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts\/3695","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/comments?post=3695"}],"version-history":[{"count":3,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts\/3695\/revisions"}],"predecessor-version":[{"id":3704,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts\/3695\/revisions\/3704"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/media\/3702"}],"wp:attachment":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/media?parent=3695"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/categories?post=3695"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/tags?post=3695"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}