lookout cloud orphans
Billing-active cloud leftovers: unattached GCE disks and reserved-but-unused external static IPs older than —min-age, and forwarding rules/LBs routing to zero endpoints; opt-in —only=nodepools adds node pools with nodes but no workload pods — cost and hygiene sweep, not an incident read.
MCP tool: k8s_cloud_orphans
lookout cloud orphans [flags]| Flag | Type | Default | Meaning |
|---|---|---|---|
--only | string | disks,lbs,addresses | resource classes to sweep, comma-separated: disks, lbs, addresses, nodepools (nodepools is opt-in: never in the default, judged on one observation, and reads cluster Nodes and Pods) |
--min-age | duration | 24h0m0s | report a disk only when unattached at least this long (age from last detach, else creation), and an address only when reserved at least this long; disks and addresses with no datable age are always reported |
--project-wide | bool | — | sweep unattached disks across the entire GCP project instead of scoping to the target cluster’s zone or region |
Common flags (every lookout command)
Section titled “Common flags (every lookout command)”| Flag | Type | Default | Meaning |
|---|---|---|---|
--namespace | string | — | limit the scan to one namespace |
-A | bool | — | scan all namespaces |
--workload | string | — | target one workload as <Kind>/<namespace>/<name>, e.g. Deployment/prod/api |
--since | duration | — | how far back to look (0 = command default) |
--format | string | logfmt | output format: logfmt|json (one record per line either way) |
--timeout | duration | 10s | abort the invocation after this long (exit 1) |
--kubeconfig | string | — | path to a kubeconfig file, instead of $KUBECONFIG / ~/.kube/config |
--kubeconfig-dir | string | — | directory of kubeconfig files to fan out across (mutually exclusive with —kubeconfig); each finding is stamped with cluster=<label> and the summary reports clusters=<n> |
--context | string | — | kubeconfig context to read, instead of its current-context. Selects a cluster for THIS invocation only — nothing is written back — so concurrent invocations can target different clusters. Reported as context=<name> in the summary line |
--contexts | string | — | comma-separated kubeconfig contexts to fan out across, or ’*’ for every context in the selected kubeconfig(s) (mutually exclusive with —context); each finding is stamped with cluster=<label> and the summary reports clusters=<n> |
--concurrency | int | 4 | maximum concurrent cluster executions when fanning out with —contexts or —kubeconfig-dir |
--google-auth | string | — | how Google Cloud and GKE DNS requests authenticate: auto (default: honors LOOKOUT_GOOGLE_AUTH, CORE_AGENT_GOOGLE_AUTH, MAST_GOOGLE_AUTH), adc, or injected (static placeholder bearer token, zero GCE metadata lookups) |
--exemptions | string | — | path to a git-reviewed exemption file (YAML); covered findings are ANNOTATED with their reason and expiry and counted as exempt=<n> in the summary, never dropped |
Finding kinds
Section titled “Finding kinds”Every kind= this command can emit, and the severities it carries them at. Nothing else appears in its output; a kind absent from a run means the check looked and found nothing. See the finding-kind glossary for the whole vocabulary.
| Kind | Severity | Claim |
|---|---|---|
orphan.disk | warning | a GCE disk has been unattached for at least —min-age and is still billing |
orphan.lb | warning | a forwarding rule or load balancer routes to zero endpoints and is still billing |
orphan.address | warning, info | an external static IP has been reserved for at least —min-age, nothing uses it, and it is still billing — warning when no Cloud DNS record in the project resolves to it (or the DNS check could not run, which the record says); info, reason=ReferencedByDNS, when DNS records still point at it, because releasing it would leave those names dangling |
orphan.nodepool | info | —only=nodepools: a node pool has at least one node and no workload pod scheduled on any of them (DaemonSet-owned and mirror/static pods do not count), judged on this one observation — info, because a batch pool between runs looks the same; the reason names the autoscaler case and so the remedy |
cloud.unavailable | info | the cloud capability this check needs is unavailable, so nothing was examined — an explicit degradation record, never silence |
read.unavailable | info | a resource this command reads was refused (RBAC forbidden, e.g. Nodes, Secrets or RBAC objects under the built-in view role) or is not served, so the checks that need it did not run and their silence is not a clean bill; everything else was still verified. The message names the refused verb and resource, whether it is cluster-scoped, whether the built-in view role grants it, and the grant that fixes it; resource= carries the refused resource as resource[.group] — an explicit degradation record, never silence |
Output fields
Section titled “Output fields”Beyond the shared envelope fields (kind, severity, namespace, kind_of_object, name, reason, message, fingerprint, exempt_reason, exempt_expires):
| Field | Meaning |
|---|---|
zone | orphan.disk: the disk’s zone |
size_gb | orphan.disk: provisioned size in GB (billed whether used or not) |
disk_type | orphan.disk: disk type short name (pd-ssd bills ~4x pd-standard idle) |
unused_since | orphan.disk: last detach (or creation, if never attached), RFC3339; omitted when the provider cannot date it |
unused_for | orphan.disk: how long the disk has been unattached; “unknown” when undatable |
region | orphan.lb, orphan.address, cloud.unavailable (reason=RuleUnresolved): the forwarding rule’s or address’s region (“global” for global ones) |
why | orphan.lb: the provider’s orphan judgment (e.g. which backend resolved empty) |
address | orphan.address: the reserved IP |
network_tier | orphan.address: the address’s network tier (PREMIUM or STANDARD); omitted when the provider records none |
reserved_since | orphan.address: when the address was reserved, RFC3339 — the provider records no release time, so this bounds the idle time from above; omitted when undatable |
reserved_for | orphan.address: how long ago the address was reserved; “unknown” when undatable |
dns_check | orphan.address: the Cloud DNS cross-check run before recommending release — referenced (records in the project’s Cloud DNS zones resolve to the address: reason=ReferencedByDNS, severity info, see dns_records), none_found (no record in the project’s Cloud DNS resolves to it; DNS hosted elsewhere is not checked), or unavailable (the check could not run, see dns_unavailable — verify DNS by hand before releasing) |
dns_records | orphan.address (dns_check=referenced): the records resolving to the address, “<name> <type> in zone <zone>” comma-separated — A/AAAA data and routing-policy targets, or CNAME chains through the project’s records, wildcards included — the first 5, then “and N more” |
dns_unavailable | orphan.address (dns_check=unavailable): why the Cloud DNS check could not run — the permission it needs (dns.managedZones.list or dns.resourceRecordSets.list, both in roles/dns.reader), a disabled Cloud DNS API, or the provider’s error (masked, cut to 200 characters) |
node_count | orphan.nodepool: the pool’s current nodes, counted from the cluster’s Nodes by their cloud.google.com/gke-nodepool label (the provider record carries no live count); never 0 — a pool at zero nodes costs nothing and is not reported |
excluded_pods | orphan.nodepool: running DaemonSet-owned and mirror (static) pods on the pool’s nodes — present, but not workload; 0 when the nodes run nothing at all |
machine_type | orphan.nodepool: the pool’s machine type, what each idle node bills as; omitted when the provider record names none |
autoscaling | orphan.nodepool: enabled or disabled — whether the autoscaler can shrink the pool at all |
min_node_count | orphan.nodepool: the autoscaler’s per-zone minimum; a non-zero floor is what keeps an idle autoscaled pool up (reason IdleMinNodeCount). Omitted when autoscaling is disabled or the pool uses total limits |
max_node_count | orphan.nodepool: the autoscaler’s per-zone maximum; omitted when autoscaling is disabled or the pool uses total limits |
total_min_node_count | orphan.nodepool: the autoscaler’s pool-wide minimum, reported instead of min_node_count when the pool sets total limits |
total_max_node_count | orphan.nodepool: the autoscaler’s pool-wide maximum, reported instead of max_node_count when the pool sets total limits |
autoprovisioned | orphan.nodepool: true when node auto-provisioning created the pool (and deletes it once empty); omitted otherwise |
nodepools_skipped | summary-line note: why —only=nodepools swept no pools although the provider answered (an Autopilot cluster: node pools are provider-managed and billed per pod) |
scope | summary-line note: disk sweep scope — cluster-zones when filtered to the target cluster’s zone/region, or project when sweeping the whole GCP project (—project-wide or cluster location unknown) |
class | cloud.unavailable (reason=PermissionDenied, SweepFailed or RuleUnresolved): the —only class whose sweep the provider refused or failed (disks, lbs, addresses, nodepools), or that the unresolved rule belongs to (lbs); the other selected classes are still swept, and the summary’s unavailable= note lists each such class with its permission, “sweep failed”, or its count of unresolved rules |
error | cloud.unavailable (reason=SweepFailed): the provider error that ended the class’s sweep (e.g. a 400 or 500 from the cloud API) — nothing from the failed class is reported, never a partial list; (reason=RuleUnresolved): the error on that one forwarding rule’s backend chain (e.g. a 404 for a backend service deleted mid-sweep). Masked and cut to 300 characters |
permission | cloud.unavailable (reason=PermissionDenied, or RuleUnresolved on a refusal): the provider permission the refused call needed (e.g. compute.addresses.list, container.clusters.get); omitted when the provider did not name it |
capability | cloud.unavailable: the provider capability a selected class needed (orphans for disks, lbs and addresses; cluster-config for nodepools) |
provider | cloud.unavailable: the provider that was asked |
unavailable | summary-line note: why the cloud read could not be served — the capability reason when no selected class could run, else one class: cause fragment per class that could not (a missing capability, a refused permission, a failed provider call — “sweep failed” — or a forbidden Node/Pod List for nodepools), plus “lbs: N rules unresolved” when some forwarding rules could not be judged (“(20 listed)” when the RuleUnresolved records were capped), and “addresses: DNS check not run (<why>)” when addresses were reported without the Cloud DNS cross-check |
resource | read.unavailable: the resource that could not be read, as resource[.group] |
Output contract
Section titled “Output contract”Output: one finding per line (logfmt; —format=json for one JSON object
per line), keys in fixed order; healthy resources emit nothing. The final
line is always the summary: scanned=
Examples
Section titled “Examples”lookout cloud orphanslookout cloud orphans --only=disks --min-age=72hlookout cloud orphans --only=lbs --format=jsonlookout cloud orphans --only=addresseslookout cloud orphans --only=nodepools