{"id":11535,"date":"2025-07-26T19:40:41","date_gmt":"2025-07-26T19:40:41","guid":{"rendered":"https:\/\/putridparrot.com\/blog\/?p=11535"},"modified":"2025-07-27T10:29:17","modified_gmt":"2025-07-27T10:29:17","slug":"adding-prometheus-grafana-to-your-kubernetes-cluster","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/adding-prometheus-grafana-to-your-kubernetes-cluster\/","title":{"rendered":"Adding Prometheus\/Grafana to your Kubernetes Cluster"},"content":{"rendered":"<p>Let&#8217;s assume you&#8217;ve got a running Kubernetes cluster set up, with some services running and you&#8217;d like to monitor the state of the cluster\/namespace or specific pods. Using Prometheus along with Grafana is a great solution.<\/p>\n<p>To deploy, just follow these steps by executing the following commands (you&#8217;ll need helm installed).<\/p>\n<ul>\n<li>helm repo add prometheus-community https:\/\/prometheus-community.github.io\/helm-charts<\/li>\n<li>helm repo update<\/li>\n<li>helm install prometheus prometheus-community\/kube-prometheus-stack &#8211;namespace monitoring &#8211;create-namespace<\/li>\n<\/ul>\n<p>With the last command you should see something like the following<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nResponse was\r\nNAME: prometheus\r\nLAST DEPLOYED: Sat Jul 26 12:03:34 2025\r\nNAMESPACE: monitoring\r\nSTATUS: deployed\r\nREVISION: 1\r\nNOTES:\r\nkube-prometheus-stack has been installed. Check its status by running:\r\n<\/pre>\n<p>Now to check everything is working and to use Grafana Dashboards, simply use port forwarding, i.e.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nkubectl port-forward svc\/prometheus-grafana 80:80 -n monitoring\r\n<\/pre>\n<p>Now you can access http:\/\/localhost:80 (or whatever port has been set up). <\/p>\n<p>Default login credentials are username\/password admin\/prom-operator.<\/p>\n<p><strong>Azure Managed Prometheus<\/strong><\/p>\n<p>You can also use Azure&#8217;s managed Prometheus instance.<\/p>\n<p>I&#8217;ve not tried setting this up via Azure, so the steps below are taken from another source (sorry I cannot recall where), feel free to try them<\/p>\n<ul>\n<li>Enable Azure Monitor Managed Prometheus<\/li>\n<li>Go to your AKS cluster in the Azure Portal.<\/li>\n<li>Under Monitoring, enable Managed Prometheus.<\/li>\n<li>Create Azure Managed Grafana<\/li>\n<li>Use the Azure Portal or CLI to create a Grafana instance.<\/li>\n<li>Link it to your Azure Monitor workspace.<\/li>\n<li>Configure Grafana Data Source<\/li>\n<li>In Grafana, add a Prometheus data source.<\/li>\n<li>Use the Azure Monitor workspace query endpoint.<\/li>\n<li>Assign Permissions<\/li>\n<li>Ensure your Grafana instance or app registration has the Monitoring Data Reader role on the workspace.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s assume you&#8217;ve got a running Kubernetes cluster set up, with some services running and you&#8217;d like to monitor the state of the cluster\/namespace or specific pods. Using Prometheus along with Grafana is a great solution. To deploy, just follow these steps by executing the following commands (you&#8217;ll need helm installed). helm repo add prometheus-community [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[746,314,745],"tags":[],"class_list":["post-11535","post","type-post","status-publish","format-standard","hentry","category-grafana","category-kubernetes","category-prometheus"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/11535","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=11535"}],"version-history":[{"count":6,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/11535\/revisions"}],"predecessor-version":[{"id":11549,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/11535\/revisions\/11549"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=11535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=11535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=11535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}