Skip to content

CLI

CLI Output Formats

Print kubeadapt output as a table, JSON, or YAML. Covers the JSON envelope, money fields, pagination metadata, and jq recipes.


Every command accepts -o (or --output) with table, json, or yaml. The default is table.

bash
kubeadapt get clusters -o json
kubeadapt get clusters -o yaml
kubeadapt get clusters          # defaults to table

Table

The default format. Headers and status values are colored.

bash
kubeadapt get clusters --no-color

Example output:

plaintext
1╭──────────────────────────────────────┬────────────┬──────────┬───────────┬─────────────┬────────┬───────┬───────┬──────────╮
2│ ID                                   │ Name       │ Provider │ Region    │ Environment │ Status │ CPU%  │ Mem%  │ $/hr     │
3├──────────────────────────────────────┼────────────┼──────────┼───────────┼─────────────┼────────┼───────┼───────┼──────────┤
4│ c1a2b3c4-d5e6-7890-abcd-ef1234567890 │ production │ aws      │ eu-west-1 │ production  │ active │ 41.2% │ 63.8% │ $12.4700 │
5│ 9b2e47d1-8c05-4f36-b1ae-7d40e9a2c518 │ staging    │ aws      │ us-east-1 │ staging     │ active │ 11.5% │ 29.1% │ $4.2100  │
6╰──────────────────────────────────────┴────────────┴──────────┴───────────┴─────────────┴────────┴───────┴───────┴──────────╯
7
8Showing 2 (limit 100). End of results.

The footer shows how many rows were printed. When more results exist, it prints the --cursor=<value> to pass for the next page. --quiet drops the footer text but keeps the cursor line.

JSON

Pass -o json for machine-readable output. List commands wrap results in a data array and add a meta block with the request ID and pagination state:

bash
kubeadapt get clusters -o json

Example output (abridged: each cluster also carries a capacity block, and utilization also has memory, gpu, and more counts):

json
1{
2  "data": [
3    {
4      "id": "c1a2b3c4-d5e6-7890-abcd-ef1234567890",
5      "kind": "Cluster",
6      "metadata": {
7        "name": "production",
8        "provider": "aws",
9        "region": "eu-west-1",
10        "environment": "production",
11        "status": "active",
12        "is_stale": false
13      },
14      "utilization": {
15        "cpu": {
16          "requested_cores": 38.5,
17          "used_cores": 19.7,
18          "utilization_percent": 41.2
19        },
20        "counts": {
21          "nodes": 12
22        }
23      },
24      "cost": {
25        "current_run_rate_hourly": {
26          "amount": "12.4700",
27          "currency": "USD"
28        },
29        "last_updated_at": "2026-09-23T10:29:00Z"
30      }
31    }
32  ],
33  "meta": {
34    "request_id": "6f411a29-2070-4dac-99e4-cbfd2c39e14d",
35    "applied_at": "2026-09-23T10:30:00Z",
36    "pagination": {
37      "has_more": false,
38      "limit": 100
39    }
40  }
41}

Things to know when parsing:

  • Lists are under data. When more pages exist, meta.pagination.has_more is true and meta.pagination.next_cursor holds the cursor. --include-total adds meta.pagination.total_count.
  • Single-resource commands such as get cluster <id>, get dashboard, and version print the bare object, with no data or meta wrapper.
  • Money fields are objects with a decimal-string amount and a currency, for example {"amount": "12.4700", "currency": "USD"}. Convert with tonumber in jq.
  • Costs are hourly run rates (cost.current_run_rate_hourly), and recommendation savings are savings.estimated_hourly. Multiply by 730 for a rough monthly figure at the current rate.
  • Partial runs: if a --paginate run stops early, the document adds "partial": true and a resume_cursor, and the command exits 1.

YAML

Pass -o yaml for YAML output. It has the same structure as JSON, with keys sorted alphabetically.

bash
kubeadapt get clusters -o yaml

Example output (abridged the same way as the JSON above):

yaml
1data:
2- cost:
3    current_run_rate_hourly:
4      amount: "12.4700"
5      currency: USD
6    last_updated_at: "2026-09-23T10:29:00Z"
7  id: c1a2b3c4-d5e6-7890-abcd-ef1234567890
8  kind: Cluster
9  metadata:
10    environment: production
11    is_stale: false
12    name: production
13    provider: aws
14    region: eu-west-1
15    status: active
16meta:
17  applied_at: "2026-09-23T10:30:00Z"
18  pagination:
19    has_more: false
20    limit: 100
21  request_id: 6f411a29-2070-4dac-99e4-cbfd2c39e14d

jq recipes

Common patterns for extracting cost data from JSON output. Use --paginate whenever a recipe aggregates over every item, or it only sees the first page.

bash
1# Top 5 workloads by hourly cost
2kubeadapt get workloads --paginate --limit 500 -o json | jq '[.data[] | {name: .metadata.name, namespace: .metadata.namespace, hourly: (.cost.current_run_rate_hourly.amount | tonumber)}] | sort_by(-.hourly)[:5]'
3
4# Total hourly savings from pending recommendations
5kubeadapt get recommendations --status pending --paginate --limit 500 -o json | jq '[.data[].savings.estimated_hourly.amount | tonumber] | add'
6
7# Teams costing more than $1.50/hour
8kubeadapt get teams --paginate -o json | jq '[.data[] | select((.cost.current_run_rate_hourly.amount | tonumber) > 1.5) | {team: .metadata.name, hourly: .cost.current_run_rate_hourly.amount}]'