Skip to main content

Overview

A small agent runs inside your cluster, reads namespace, pod and node metrics every few minutes, and reports them to CostOptix. CostOptix turns them into cost per workload and per team, and at month end reconciles the total to your real cloud invoice. Kubernetes cost accrues live from metrics, so there is no billing lag.
Works on any cluster: managed (EKS, AKS, GKE, DigitalOcean, Linode) or self-hosted (k3s, bare metal, on-prem). The agent reads the standard Kubernetes API and metrics.k8s.io.

Workload attribution

Cost follows the owning Deployment, StatefulSet, DaemonSet or Job, not short-lived pod names.

Invoice reconciliation

Monthly bills match what you actually paid, after discounts and commitments.

What to fix first

Reliability risks and the biggest savings, ranked for you.

Dependency map

Which workloads call which, and what breaks if one goes down.

How it works

1

The agent collects metrics

A single-replica Deployment in the cost-optix namespace reads namespace, pod and node metrics and pushes a compact batch to CostOptix over TLS.
2

Pods are resolved to workloads

Each pod is mapped to its owner through OwnerReferences (pod → ReplicaSet → Deployment, or straight to a StatefulSet, DaemonSet or Job), so cost survives pod churn.
3

Cost is worked out from requests and usage

Resource-hours are priced at node rates. Every workload’s cost adds up exactly to the cluster total, with nothing dropped or counted twice. Capacity nobody requested is shown as idle.
4

Days and months are sealed

Each completed day is sealed into an append-only ledger. At month end the month closes into a bill. Sealed days and bills never change.

Requirements


Connect a cluster

Open Kubernetes and follow the guided steps. The key and command are filled in for you.
1

Name the cluster and pick where it runs

Enter a cluster ID you will recognise, such as prod-eu. Then pick where it runs: azure, aws, gcp, digitalocean, linode, k3s, bare-metal or on-prem. Cloud nodes are priced automatically from the provider’s rates.For self-hosted clusters, tell CostOptix what the hardware costs: either the total monthly cost and capacity, or your own per-vCPU-hour and per-GiB-hour rates. You can skip this and set it later. Until then the cluster uses a rough estimate.
2

Create an agent key

Click Create agent key. The key can only push cluster metrics. Copy it now, it is shown only once. If you cannot create keys, ask an admin.
3

Run the installer

Point kubectl at the cluster and run the generated command. The cluster appears as soon as the agent’s first report arrives.
Tick Map which workloads call which to add --with-connections. See Dependency map. The installer creates the cost-optix namespace, a least-privilege ServiceAccount and ClusterRole, a Secret holding the key, a ConfigMap and a single-replica Deployment, then waits for the rollout.

Prefer to apply a manifest?

The onboarding also offers a manifest option for GitOps or review. Set these values in the agent manifest and kubectl apply it:
The agent’s ClusterRole is read-only:
The apps/replicasets rule is needed for workload attribution. Without it, pods are attributed by ReplicaSet name instead of their Deployment.

Check the install

The agent serves /healthz (process is up) and /readyz (at least one collection succeeded and recent pushes work) on port 8090. A failing readiness probe without restarts usually means a wrong key.

The Kubernetes page

Days are counted in UTC, so a new day starts at midnight UTC.

What to fix first

The Waste & fixes tab ranks findings for you. Reliability risks come first, because an outage costs more than waste. Then come the changes that save the most money.
  • Over-provisioned means a workload asks for more CPU or memory than it uses. A safe saving.
  • Under-provisioned means it uses more than it asked for. A reliability risk, not a saving.
  • Idle is node capacity no workload has claimed. Fewer or smaller nodes is the usual fix.
Pod rightsizing, node sizing and idle capacity also appear on the Kubernetes tab of Recommendations, where savings are verified after you act.

Invoice reconciliation

Live Kubernetes cost is an estimate built from metrics and list rates. Your cloud invoice is what you actually paid. Link the two and every monthly bill is scaled to the invoice, so reservations, savings plans, spot and negotiated discounts are all reflected. On the Cluster tab, open the billing link settings and choose:
  1. Cloud account: the connected account that pays for the cluster’s nodes.
  2. How to find the nodes on the invoice:
At month close every attributed line is scaled by:
The billed lines sum to your amortised invoice exactly, to the cent. The month-close job refuses to seal a bill that does not balance. Without a link, bills use estimated rates and say so. Self-hosted clusters have no cloud invoice, so they always use the hardware cost you set. Removing a link affects future bills only.
Linking a cluster also tells the Overview that the cluster’s nodes are already inside that cloud bill, so they are not counted twice.

Nodes that also run the host agent

If some nodes also run the host agent, each linked machine’s Kubernetes share becomes its cost here, and the cluster page shows how many nodes are covered.

Teams and chargeback

Teams claim namespaces or individual workloads on the Ownership page. Each workload can belong to only one team, so totals never double count.
  • Direct cost is the sum of a team’s claimed workloads.
  • Idle cost is split across teams in proportion to their direct cost.
  • Unclaimed workloads are shown as unclaimed, never dropped.
Each month closes into a sealed, reconciled bill per team. Ownership needs Professional or above.

Dependency map

Connection mapping is optional. It adds one small pod per node (a DaemonSet) that reads the node’s connection table, so it runs as root on the node’s network. It records which workloads were connected, never what the connections carry. Turn it on during install with --with-connections, or later from Agent health on the Cluster tab. The Dependencies tab then shows which workloads call which and what each one brings down with it.
Clusters that enforce Pod Security admission need the cost-optix namespace labelled pod-security.kubernetes.io/enforce=privileged for the connection pods. The installer sets this when you use --with-connections.

Agent health and upgrades

Agent health on the Cluster tab checks that the agent is reporting, whether a newer version is out, when the agent key expires, and whether connection mapping is reporting from every node. To upgrade, run this with kubectl pointed at the cluster. It reuses the key, cluster ID and settings already in the cluster, so the cluster keeps its history:
Add a version tag after --upgrade to pin one, and --with-connections to turn on mapping at the same time. The agent runs as a single replica by design. A second replica would push duplicate metrics.

Limits

Plans count Kubernetes nodes, not clusters. The Kubernetes page shows how many nodes you are using against your limit. See Subscription Tiers.

Removing a cluster

Delete the namespace and the cluster-scoped RBAC:
The ClusterRole and ClusterRoleBinding survive a namespace delete, so remove them separately. Then delete the cluster from the Kubernetes page to remove its history from CostOptix.

Security

The agent has read-only access to cluster metadata and metrics. It never creates, changes, scales or deletes anything. It runs as a non-root user from a minimal image with no shell or package manager, and only connects out to the CostOptix API over TLS. You can restrict egress with a NetworkPolicy that allows only the CostOptix API, the API server and DNS. The optional connection mapping pods are the exception to non-root: they need root on the node’s network to read its connection table. See Security for the full platform model.