惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

A
Arctic Wolf
T
Tenable Blog
T
Troy Hunt's Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Privacy & Cybersecurity Law Blog
NISL@THU
NISL@THU
Application and Cybersecurity Blog
Application and Cybersecurity Blog
H
Hacker News: Front Page
S
Secure Thoughts
AWS News Blog
AWS News Blog
L
LINUX DO - 最新话题
D
Darknet – Hacking Tools, Hacker News & Cyber Security
M
MIT News - Artificial intelligence
T
Tor Project blog
S
Schneier on Security
PCI Perspectives
PCI Perspectives
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
美团技术团队
Google DeepMind News
Google DeepMind News
V
Visual Studio Blog
爱范儿
爱范儿
Google DeepMind News
Google DeepMind News
Cyberwarzone
Cyberwarzone
T
The Exploit Database - CXSecurity.com
罗磊的独立博客
T
Threat Research - Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
V
V2EX
C
CXSECURITY Database RSS Feed - CXSecurity.com
Stack Overflow Blog
Stack Overflow Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
G
GRAHAM CLULEY
L
LINUX DO - 热门话题
D
Docker
J
Java Code Geeks
GbyAI
GbyAI
H
Heimdal Security Blog
The Hacker News
The Hacker News
MongoDB | Blog
MongoDB | Blog
V
Vulnerabilities – Threatpost
T
Tailwind CSS Blog
Cloudbric
Cloudbric
TaoSecurity Blog
TaoSecurity Blog
C
CERT Recently Published Vulnerability Notes
Y
Y Combinator Blog
Recorded Future
Recorded Future
Cisco Talos Blog
Cisco Talos Blog
T
Threatpost
The Register - Security
The Register - Security
Hacker News - Newest:
Hacker News - Newest: "LLM"

VictoriaMetrics: Simple & Reliable Monitoring for Everyone on VictoriaMetrics

Operator now has Long-Term Support (LTS) version Multi-tiered Observability: A Practical Way to Handle Diverse Workloads VictoriaMetrics April 2026 Ecosystem Updates Not All Telemetry Requires Premium Pricing VictoriaMetrics at KubeCon Amsterdam: Community Highlights What's new in VictoriaMetrics Anomaly Detection (Q1 2026) What's New in VictoriaMetrics Cloud Q1 2026? Logs, MCP Server, Better Alerting, and... a Secret Project VictoriaMetrics at KubeCon: Optimizing Tail Sampling in OpenTelemetry with Retroactive Sampling VictoriaMetrics March 2026 Ecosystem Updates Observability Lessons From OpenAI Benchmarking Kubernetes Log Collectors: vlagent, Vector, Fluent Bit, OpenTelemetry Collector, and more VictoriaMetrics February 2026 Ecosystem Updates VictoriaMetrics at FOSDEM, Cloud Native Days France, and CfgMgmtCamp Ghent VictoriaLogs in VictoriaMetrics Cloud: Fast, Cost-Effective Log Management is Here What’s new in VictoriaMetrics Anomaly Detection (2025) VictoriaMetrics January 2026 Ecosystem Updates VictoriaLogs Basics: What You Need to Know, with Examples & Visuals What's New in VictoriaMetrics Cloud Q4 2025? New tiers, more deployment options, IaC and alerting rules. Vibe coding tools observability with VictoriaMetrics Stack and OpenTelemetry How a US Software Provider Improved Traffic Alerting with VictoriaMetrics Anomaly Detection VictoriaMetrics 2025 Developer Experience: A Year in Review Spotify’s performance & control across large monitoring environments with VictoriaMetrics VictoriaMetrics Achieves Red Hat OpenShift Operator Certification Our latest updates across the VictoriaMetrics Observability ecosystem New Capacity Tiers in VictoriaMetrics Cloud Announcing 1B+ Downloads & Product Development With Logs, Traces, Metrics AI Agents Observability with OpenTelemetry and the VictoriaMetrics Stack Discarding gRPC-Go: The Story Behind OTLP/gRPC Support in VictoriaTraces What's New in VictoriaMetrics Cloud Q3 2025? From new region in Asia to proactive alerts How DreamHost Slashed Memory Usage by 80% and Scaled to 76 Million Time Series Upcoming Conferences & Meetups: Where to Meet Our Team VictoriaMetrics Long-Term Support (LTS): H2 2025 Update Creating a Sustainable Open Source Business Model - Introduction Full-Stack Observability with VictoriaMetrics in the OTel Demo Alerting Best Practices vmanomaly Deep Dive: Smarter Alerting with AI (Tech Talk Companion) VictoriaLogs Practical Ingestion Guide for Message, Time and Streams Monotonic and Wall Clock Time in the Go time package Hello Singapore! VictoriaMetrics Cloud Expands to Asia Pacific MCP Server Integration & Much More: What's New in VictoriaMetrics Cloud Q2 2025 FIPS 140-3 Compatible Builds for VictoriaMetrics Enterprise Components VictoriaLogs Unleashed: Cluster Version Now Available for Exceptional, Linear Scaling Integrations made easy with VictoriaMetrics Cloud Developer's Note: Research on Distributed Tracing, Comparing With Tempo and ClickHouse vmagent: Key Features Explained in Under 15 Minutes Go synctest: Solving Flaky Tests vmalert: Maximize Your Monitoring (Tech Talk Companion) Celebrating 14K Stars on GitHub: Spring Update vmalert: Maximize Your Monitoring VictoriaMetrics Connects with the Open Source Community at LinuxFest Northwest 2025 Graceful Shutdown in Go: Practical Patterns VictoriaLogs: Gaps, Gains & Growth Prometheus Monitoring: Functions, Subqueries, Operators, and Modifiers VictoriaMetrics Cloud: What's New in Q1 2025? Don’t default to microservices: You’ll thank us later! Container CPU Requests & Limits Explained with GOMAXPROCS Tuning gRPC in Go: Streaming RPCs, Interceptors, and Metadata From Chaos to Clarity with VictoriaLogs Prometheus Alerting 101: Rules, Recording Rules, and Alertmanager Heading to London: Meet Our Team at KubeCon Europe 2025 Inside vmselect: The Query Processing Engine of VictoriaMetrics Meet Our Team at Scale 22x Practical Protobuf - From Basic to Best Practices VictoriaLogs Status Update: Heading Towards the Cluster Version 24th of February 2025 Statement: VictoriaMetrics Stands with Ukraine! Prometheus Metrics Explained: Counters, Gauges, Histograms & Summaries Prometheus Monitoring: Instant Queries and Range Queries Explained 300%+ Growth in 2024: Join Our Team in 2025! FOSDEM 2025 recap How Protobuf Works—The Art of Data Encoding OpenTelemetry, Prometheus, and More: Which Is Better for Metrics Collection and Propagation? How vmstorage Handles Query Requests From vmselect How vmstorage's IndexDB Works VictoriaMetrics Tech Talk Stream: A Deep Dive into Blackbox Monitoring How HTTP/2 Works and How to Enable It in Go VictoriaMetrics Cloud: What's New in Q4 2024? How vmstorage Processes Data: Retention, Merging, Deduplication,... How vmstorage Handles Data Ingestion From vminsert When Metrics Meet vminsert: A Data-Delivery Story From net/rpc to gRPC in Go Applications Piros | VictoriaMetrics Partner Allenta | VictoriaMetrics Partner CloudRaft | VictoriaMetrics Partner Sensedia & VictoriaMetrics: API-compatible Efficient Storage Scalable Prometheus: Why DSV Chose VictoriaMetrics Sensor Factory | VictoriaMetrics Partner Erythix | VictoriaMetrics Partner Groove X & VictoriaMetrics: Faster Device Health Monitoring Scaled & Performant Monitoring at Spotify with VictoriaMetrics Grammarly & VictoriaMetrics: 10× Lower Costs & Direct Access Zelarsoft | VictoriaMetrics Partner DFKI & VictoriaMetrics: Efficient Long-Term Metric Storage Niubits | VictoriaMetrics Partner Megazone Cloud | VictoriaMetrics Partner Cogito Software | VictoriaMetrics Partner Bajau | VictoriaMetrics Partner Find Out Why Dig Security Chose VictoriaMetrics! Ness | VictoriaMetrics Partner Alpha Data | VictoriaMetrics Partner SIOS Technology | VictoriaMetrics Partner
Monitoring Kubernetes costs with OpenCost and VictoriaMetrics
Zakhar Bessarab · 2023-10-09 · via VictoriaMetrics: Simple & Reliable Monitoring for Everyone on VictoriaMetrics

This article is based on a feature, that was released in OpenCost v1.110.0.


Control over operational costs is pivotal in Kubernetes’ deployment and management. Although Kubernetes brings power and control over your deployments, it also necessitates thorough understanding and management of costs. OpenCost, specifically designed for Kubernetes cost monitoring, combined with VictoriaMetrics, an efficient time series database, offers a comprehensive solution for this challenge.

This article is a step-by-step guide for setting up OpenCost and integrating it with VictoriaMetrics for Kubernetes cost monitoring.

What is OpenCost?

#

OpenCost is a CNCF project and open-source tool for monitoring Kubernetes costs. It is designed to provide a comprehensive overview of the costs of Kubernetes clusters across multiple cloud providers and regions, and also supports on-premises installations.

OpenCost allows you to monitor the costs of Kubernetes cluster in real-time and provides a detailed breakdown of the costs for each Kubernetes resource.

How it works

#

OpenCost employs node-exporter and kube-state-metrics (KSM) metrics for computations. KSM metrics can either be provided directly by OpenCost or via KSM scraping.

The system includes a cost-model for cost computation based on these metrics, and a web UI is available for their visualization.

In order to retrieve billing information OpenCost relies on cloud provider APIs. Currently, OpenCost supports AWS, GCP and Azure. You can find more information about supported cloud providers in the documentation. It is also possible to provide billing information manually and for on-premises deployments.

You can find detailed information about OpenCost architecture in the documentation.

Integrating VictoriaMetrics with OpenCost

#

Example deployment of OpenCost with VictoriaMetrics will be using the OpenCost Helm chart to deploy OpenCost and victoria-metrics-k8s-stack Helm chart to deploy VictoriaMetrics and monitoring components.

By default, OpenCost assumes that metrics are stored and queried from Prometheus. Prometheus is a popular open-source time series database (TSDB) used for storing and querying metrics. On the other hand, VictoriaMetrics is a fast, cost-effective, and scalable monitoring solution and time series database. It is compatible with Prometheus and can serve as a drop-in replacement.

OpenCost expect the only Prometheus-compatible endpoint for both metrics querying and scrape configuration retrieval to be set, while VictoriaMetrics stack provides separate components (and endpoints as well) for scraping and storing metrics. That is a reason why scrape interval should be configured explicitly using KUBECOST_SCRAPE_INTERVAL environment variable to override default (1m) if it’s needed.

All examples will be using vm namespace for deployment of VictoriaMetrics components and namespace opencost for deployment of OpenCost components. Note that URLs for VictoriaMetrics components need to be adjusted based on the namespace they are deployed in and the Helm release name.

Single-node VictoriaMetrics deployment

#

In order to deploy single-node VictoriaMetrics, it is necessary to use the following Helm values for VictoriaMetrics k8s-stack Helm chart:

victoria-metrics-k8s-stack:
  vmagent:
    spec:
      externalLabels:
        cluster: k3d-1
  vmsingle:
    enabled: true

Helm values for OpenCost components:

opencost:
  exporter:
    image:
      tag: 1.110
    extraEnv:
      KUBECOST_SCRAPE_INTERVAL: 1m
      PROM_CLUSTER_ID_LABEL: cluster
  prometheus:
    external:
      enabled: true
      url: http://vmsingle-vm-victoria-metrics-k8s-stack.vm.svc:8429/prometheus
    internal:
      enabled: false

VictoriaMetrics cluster deployment

#

In order to deploy VictoriaMetrics cluster, it is necessary to use the following Helm values for VictoriaMetrics k8s-stack Helm chart:

victoria-metrics-k8s-stack:
  vmagent:
    externalLabels:
      cluster: k3d-1
  vmsingle:
    enabled: false
  vmcluster:
    enabled: true

Helm values for OpenCost components:

opencost:
  exporter:
    image:
      tag: 1.110
    defaultClusterId: "k3d-1"
    extraEnv:
      KUBECOST_SCRAPE_INTERVAL: 1m
      PROM_CLUSTER_ID_LABEL: cluster
  prometheus:
    external:
      enabled: true
      url: http://vmselect-vm-victoria-metrics-k8s-stack.vm.svc:8481/select/0/prometheus
    internal:
      enabled: false

Monitoring multiple clusters with OpenCost

#

In order to monitor multiple clusters with OpenCost, it is necessary to deploy OpenCost components in each cluster and configure clusters to use the same VictoriaMetrics cluster for storing metrics. Note, that it is required to attach a label with cluster ID to each cluster. For VictoriaMetrics k8s-stack Helm chart this can be done by setting spec.vmagent.externalLabels.cluster value:

victoria-metrics-k8s-stack:
  vmagent:
    externalLabels:
      cluster: cluster-id

For this purpose in the previous examples cluster label was set to k3d-1.

After that it is necessary to configure OpenCost to use different cluster IDs for each cluster. This can be done by setting PROM_CLUSTER_ID_LABEL environment variable for OpenCost components. In the previous examples PROM_CLUSTER_ID_LABEL was set to cluster to match the label attached by vmagent.

Once this is done, it is possible to use OpenCost UI to group costs by cluster ID and get a breakdown of costs for each cluster.

Implementing Real-Time Costs Monitoring

#

In order to implement real-time costs monitoring with OpenCost and VictoriaMetrics it is necessary to configure scraping OpenCost metrics by VictoriaMetrics. This can be done by deploying the following manifest:

apiVersion: operator.victoriametrics.com/v1beta1
kind: VMServiceScrape
metadata:
  name: opencost
spec:
  endpoints:
    - port: http
      path: /metrics
  selector:
    matchLabels:
      app.kubernetes.io/instance: opencost

This manifest will be used by VictoriaMetrics operator to configure scraping of OpenCost metrics by vmagent.

Once metrics are scraped by vmagent, it is possible to use them in Grafana dashboards. You can find an example of such a dashboard provided by OpenCost here.

Conclusion

#

In conclusion, monitoring operational costs is crucial for management and deployment of Kubernetes. Together with OpenCost and a time series database like VictoriaMetrics, we can build an effective cost monitoring system. Since OpenCost provides a comprehensive overview of Kubernetes costs across different cloud platforms and regions, and VictoriaMetrics is extremely efficient on storing time series data.

The combination of these two systems help tracking Kubernetes costs in real-time, with detailed cost breakdowns and helpful graphical representations. These insights are invaluable for maintaining control over operational costs and ensuring financial efficiency in Kubernetes deployments.