Kubernetes Cost Monitoring with Prometheus & Grafana

Screenshot of a Grafana dashboard to calculate costs

Setting Up Prometheus Operator

kubectl create namespace monitoring
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm search repo prometheus-community
Screenshot of the output listing possible Helm packages to install
helm install prometheus-stack --namespace monitoring prometheus-community/kube-prometheus-stack
kubectl get pod --namespace=monitoring
Output from the “kubectl get pods” command
  • prometheus-stack-grafana-* - the Grafana dashboard
  • prometheus-prometheus-kube-prometheus-prometheus-0 - the Prometheus instance
kubectl port-forward <prometheus-pod> 9090 --address=0.0.0.0
kubectl port-forward <grafana-pod> 3000 --address=0.0.0.0
Screenshot of the Prometheus TSDB status

Monitoring Your Cost

(sum(container_cpu_usage_seconds_total) / 60 / 60 ) * 0.0445
Screenshot of the results of that Prometheus query

Alternative Options

--

--

--

>> www.loft.sh << Build Your Internal Kubernetes Platform With Virtual Clusters, Namespace Self-Service & Secure Multi-Tenancy

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Footprinting Target Network | footprinting tools techniques | footprinting methodology

My Resolutions for 2021

UrbanClap’s stream to MVVM

Redis clients instrumented by OpenCensus in Java and Go

What makes your system more reliable

CS373 Spring 2022: Daniel Fernandez

Database Papers: Anti-Entropy without Merkle Trees, Deletes without Tombstones

What I’ve learned 4 months at Beam

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Loft Labs

Loft Labs

>> www.loft.sh << Build Your Internal Kubernetes Platform With Virtual Clusters, Namespace Self-Service & Secure Multi-Tenancy

More from Medium

Reducing Kubernetes Cost: Kubecost vs Cast.ai

Deploy Grafana Loki and Promtail using ArgoCD

Sealed Secrets with Kubernetes

Oracle Cloud Infrastructure- OKE and Terraform