---
updatedAt: 2026-11-13T21:48:27.000Z
agentTools:
  projectIndex: https://docs.cloudzero.com/llms.txt
---

# Install the CloudZero Kubernetes Agent

The CloudZero Agent for Kubernetes collects pod-level CPU, memory, and GPU usage from your clusters and sends it to CloudZero. CloudZero combines this usage data with the actual cost of each VM from your cloud provider bill to allocate Kubernetes costs by cluster, namespace, workload, and label.

The agent is read-only. It collects metrics and does not modify your clusters.

## Overview

Installing the CloudZero Agent takes four steps:

1. [Create a CloudZero API key](#step-1-create-a-cloudzero-api-key)
2. [Install the agent with Helm](#step-2-install-the-agent)
3. [Validate the installation](#step-3-validate-the-installation)
4. [(Optional) Configure Kubernetes labels](#step-4-optional-configure-kubernetes-labels)

## Supported platforms

* AWS Elastic Kubernetes Service (EKS)
* Azure Kubernetes Service (AKS)
* Google Kubernetes Engine (GKE)
* Oracle Cloud Infrastructure Kubernetes Engine (OKE)
* Self-managed Kubernetes on AWS, Azure, or Google Cloud

<Callout icon="ℹ️" theme="info">
  On OKE, CloudZero allocates the cost of the Oracle Cloud Infrastructure (OCI) compute instances that back your nodes, using the same CPU and memory allocation model as every other provider. To bring in your OCI bill, see [Connecting to Oracle Cloud (OCI)](https://docs.cloudzero.com/docs/connecting-to-oracle-cloud).
</Callout>

## What you need

* A CloudZero user with permissions to [create API keys](https://docs.cloudzero.com/docs/authorization#create-an-api-key)
* A [Kubernetes v1.23+](https://kubernetes.io/releases/) cluster with a [CRI-compliant runtime](https://kubernetes.io/docs/setup/production-environment/container-runtimes/) (for example, containerd)
* [Helm v3+](https://helm.sh)
* Network egress on port 443 to:
  * `api.cloudzero.com` (CloudZero API)
  * `*.s3.amazonaws.com` (metrics delivery)
* If your cluster uses [NetworkPolicies](https://kubernetes.io/docs/concepts/services-networking/network-policies/), allow traffic from the Kubernetes API server to the `cloudzero` namespace (the agent's admission webhook receives requests from the API server)

## Step 1: Create a CloudZero API key

The agent authenticates with CloudZero using an API key. [Create a new API key](https://docs.cloudzero.com/docs/authorization#create-an-api-key) and assign it the following five scopes.

From the **Kubernetes Agent** category (send-only container-metric upload):

* **Abandon Metric Uploads** (`container-metrics_v1:abandon`)
* **Send Cluster Status** (`container-metrics_v1:get-status`)
* **Legacy Metric Upload** (`container-metrics_v1:legacy`)
* **Upload Container Metrics** (`container-metrics_v1:upload`)

From the **Insights & Anomalies** category:

* **List Insights** (`insights:read_insights`)

<Callout icon="ℹ️" theme="info">
  **List Insights** is used only as an authentication liveness check the agent runs at startup to confirm its API key is valid. It is not used to read cost or insights data. It lives under **Insights & Anomalies** rather than **Kubernetes Agent** because each scope belongs to exactly one category.
</Callout>

## Step 2: Install the agent

<Callout icon="ℹ️" theme="info">
  Install the agent in the `cloudzero` namespace. Do not install it in the default namespace.
</Callout>

The install command requires four parameters:

| Parameter        | Description                                                                                                                                 |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `apiKey`         | The API key you created in [Step 1](#step-1-create-a-cloudzero-api-key).                                                                    |
| `clusterName`    | A name for your cluster (RFC 1123 compliant). Required on EKS, AKS, and OKE. Auto-detected on GKE.                                          |
| `cloudAccountId` | The account identifier for the cloud provider where the cluster runs. Must be passed as a string using `--set-string`. See the table below. |
| `region`         | The cloud provider region where the cluster runs (for example, `us-east-1` on AWS, or `ca-montreal-1` on Oracle Cloud).                     |

**Finding your `cloudAccountId`:**

| Provider         | Value to use                                                      | Where to find it                                                                                                                                                                                                            |
| ---------------- | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **AWS**          | 12-digit AWS account ID                                           | Top-right menu in the [AWS Console](https://docs.aws.amazon.com/IAM/latest/UserGuide/console_account-alias.html), or run `aws sts get-caller-identity`                                                                      |
| **Azure**        | Subscription ID (UUID format)                                     | **Subscriptions** in the [Azure Portal](https://portal.azure.com/#blade/Microsoft_Azure_Billing/SubscriptionsBlade), or run `az account show --query id -o tsv`                                                             |
| **GCP**          | Project number (numeric, not project ID)                          | **Project info** card on the [GCP Dashboard](https://console.cloud.google.com/home/dashboard), or run `gcloud projects describe <PROJECT_ID> --format='value(projectNumber)'`                                               |
| **Oracle Cloud** | Numeric OCI account ID, passed as a string. Not the tenancy OCID. | Oracle's documentation calls this the Subscription ID, under **Billing & Cost Management** > **Subscriptions** in the [Oracle Cloud Console](https://docs.oracle.com/en-us/iaas/Content/Billing/Concepts/subscriptions.htm) |

<Callout icon="⚠️" theme="warning">
  On Oracle Cloud, the agent accepts only the numeric OCI account ID. A tenancy OCID such as `ocid1.tenancy.oc1..aaaa...` fails validation during install.
</Callout>

<Callout icon="ℹ️" theme="info">
  `cloudAccountId` and `region` are auto-detected from the cloud provider's instance metadata service (IMDS) when the cluster runs on EKS, AKS, or GKE. On OKE, only `region` is auto-detected. Set `cloudAccountId` explicitly on OKE, because OCI's instance metadata service exposes only the tenancy OCID. If your cluster restricts access to instance metadata, set these values explicitly.
</Callout>

<Callout icon="ℹ️" theme="info">
  On GKE, `clusterName` is also auto-detected. On EKS and OKE, `clusterName` must be set explicitly. On AKS, `clusterName` must be set explicitly if the name contains underscores.
</Callout>

### Option A: Helm install (recommended)

1. Add the CloudZero Helm repository and update your local chart index:

```shell
helm repo add cloudzero https://cloudzero.github.io/cloudzero-charts
helm repo update
```

2. Run the install command, replacing the placeholder values with your own:

```shell
helm install cloudzero-agent cloudzero/cloudzero-agent \
    --namespace cloudzero --create-namespace \
    --set apiKey=<CLOUDZERO_API_KEY> \
    --set clusterName=<CLUSTER_NAME> \
    --set-string cloudAccountId=<CLOUD_ACCOUNT_ID> \
    --set region=<REGION>
```

3. Confirm Helm displays a success message when the installation completes.

### Option B: Raw YAML manifests

If your organization does not use Helm for deployments, you can generate flat Kubernetes manifests and apply them directly.

```shell
helm repo add cloudzero https://cloudzero.github.io/cloudzero-charts
helm repo update

helm template cloudzero-agent cloudzero/cloudzero-agent \
    --namespace cloudzero \
    --set apiKey=<CLOUDZERO_API_KEY> \
    --set clusterName=<CLUSTER_NAME> \
    --set-string cloudAccountId=<CLOUD_ACCOUNT_ID> \
    --set region=<REGION> > cloudzero-agent.yaml

kubectl create namespace cloudzero
kubectl apply -f cloudzero-agent.yaml -n cloudzero
```

## Step 3: Validate the installation

1. Confirm the agent pods are running:

```shell
kubectl -n cloudzero get pods
```

All pods should show a `Running` status within a few minutes.

2. Check the agent validation logs for any issues:

```shell
kubectl -n cloudzero logs -l app.kubernetes.io/part-of=cloudzero-agent,app.kubernetes.io/name=server -c env-validator-run
```

A successful validation shows all checks passing. If any check fails, see the [CloudZero Agent troubleshooting guide](https://github.com/Cloudzero/cloudzero-charts/tree/develop/charts/cloudzero-agent/docs/troubleshooting-guide.md) on GitHub.

## Step 4 (optional): Configure Kubernetes labels

By default, the agent exports only the `app.kubernetes.io/component` label from pods and namespaces. To see your own labels in CloudZero, add them before your first data appears.

1. Create a Helm values file named `values.yaml` on the machine where you run Helm commands. This file overrides the chart's default configuration:

```yaml
insightsController:
  labels:
    patterns:
      - 'app.kubernetes.io/component'
      - '^team'
      - 'environment'
      - 'app'
    resources:
      pods: true
      namespaces: true
      deployments: true
```

Patterns are regular expressions matched against label keys. For example, `'^team'` matches any label starting with "team."

2. Apply the configuration:

```shell
helm upgrade cloudzero-agent cloudzero/cloudzero-agent \
    --namespace cloudzero \
    -f values.yaml
```

For annotations, resource type options, and disambiguation rules, see [Advanced Agent Configuration](https://docs.cloudzero.com/docs/k8s-advanced-configuration).

<Callout icon="⚠️" theme="warning">
  Configure labels before your first data appears in 48 hours to ensure complete label coverage from the start.
</Callout>

## What to expect

After the agent is installed, CloudZero begins collecting metrics immediately. Cost data appears in CloudZero within 48 hours.

Once data is available, you can view Kubernetes cost breakdowns and resource efficiency in [Explorer](https://docs.cloudzero.com/docs/k8s-usage-metrics). CloudZero also generates [rightsizing recommendations](https://docs.cloudzero.com/docs/recommendations-for-kubernetes) for over-provisioned CPU and memory workloads. You can check on your connected clusters at any time from the [Kubernetes Integration page](https://docs.cloudzero.com/docs/manage-kubernetes-clusters) in Settings.

## Advanced configuration

For Kubernetes Secrets, annotations, TLS certificates, Istio compatibility, and custom kube-state-metrics, see [Advanced Agent Configuration](https://docs.cloudzero.com/docs/k8s-advanced-configuration).

<Callout icon="ℹ️" theme="info">
  Have questions or feedback? Reach out to your account manager.
</Callout>