Skip to content

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

Terminal window
lookout cloud orphans [flags]
FlagTypeDefaultMeaning
--onlystringdisks,lbs,addressesresource 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-ageduration24h0m0sreport 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-widebool—sweep unattached disks across the entire GCP project instead of scoping to the target cluster’s zone or region
FlagTypeDefaultMeaning
--namespacestring—limit the scan to one namespace
-Abool—scan all namespaces
--workloadstring—target one workload as <Kind>/<namespace>/<name>, e.g. Deployment/prod/api
--sinceduration—how far back to look (0 = command default)
--formatstringlogfmtoutput format: logfmt|json (one record per line either way)
--timeoutduration10sabort the invocation after this long (exit 1)
--kubeconfigstring—path to a kubeconfig file, instead of $KUBECONFIG / ~/.kube/config
--kubeconfig-dirstring—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>
--contextstring—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
--contextsstring—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>
--concurrencyint4maximum concurrent cluster executions when fanning out with —contexts or —kubeconfig-dir
--google-authstring—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)
--exemptionsstring—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

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.

KindSeverityClaim
orphan.diskwarninga GCE disk has been unattached for at least —min-age and is still billing
orphan.lbwarninga forwarding rule or load balancer routes to zero endpoints and is still billing
orphan.addresswarning, infoan 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.nodepoolinfo—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.unavailableinfothe cloud capability this check needs is unavailable, so nothing was examined — an explicit degradation record, never silence
read.unavailableinfoa 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

Beyond the shared envelope fields (kind, severity, namespace, kind_of_object, name, reason, message, fingerprint, exempt_reason, exempt_expires):

FieldMeaning
zoneorphan.disk: the disk’s zone
size_gborphan.disk: provisioned size in GB (billed whether used or not)
disk_typeorphan.disk: disk type short name (pd-ssd bills ~4x pd-standard idle)
unused_sinceorphan.disk: last detach (or creation, if never attached), RFC3339; omitted when the provider cannot date it
unused_fororphan.disk: how long the disk has been unattached; “unknown” when undatable
regionorphan.lb, orphan.address, cloud.unavailable (reason=RuleUnresolved): the forwarding rule’s or address’s region (“global” for global ones)
whyorphan.lb: the provider’s orphan judgment (e.g. which backend resolved empty)
addressorphan.address: the reserved IP
network_tierorphan.address: the address’s network tier (PREMIUM or STANDARD); omitted when the provider records none
reserved_sinceorphan.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_fororphan.address: how long ago the address was reserved; “unknown” when undatable
dns_checkorphan.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_recordsorphan.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_unavailableorphan.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_countorphan.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_podsorphan.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_typeorphan.nodepool: the pool’s machine type, what each idle node bills as; omitted when the provider record names none
autoscalingorphan.nodepool: enabled or disabled — whether the autoscaler can shrink the pool at all
min_node_countorphan.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_countorphan.nodepool: the autoscaler’s per-zone maximum; omitted when autoscaling is disabled or the pool uses total limits
total_min_node_countorphan.nodepool: the autoscaler’s pool-wide minimum, reported instead of min_node_count when the pool sets total limits
total_max_node_countorphan.nodepool: the autoscaler’s pool-wide maximum, reported instead of max_node_count when the pool sets total limits
autoprovisionedorphan.nodepool: true when node auto-provisioning created the pool (and deletes it once empty); omitted otherwise
nodepools_skippedsummary-line note: why —only=nodepools swept no pools although the provider answered (an Autopilot cluster: node pools are provider-managed and billed per pod)
scopesummary-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)
classcloud.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
errorcloud.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
permissioncloud.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
capabilitycloud.unavailable: the provider capability a selected class needed (orphans for disks, lbs and addresses; cluster-config for nodepools)
providercloud.unavailable: the provider that was asked
unavailablesummary-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
resourceread.unavailable: the resource that could not be read, as resource[.group]

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= findings= elapsed= — findings=0 with a summary present means “scanned and healthy”; a stream without a summary line is void. Exit 0 data, 1 runtime error (diagnostics on stderr only), 2 usage.

Terminal window
lookout cloud orphans
lookout cloud orphans --only=disks --min-age=72h
lookout cloud orphans --only=lbs --format=json
lookout cloud orphans --only=addresses
lookout cloud orphans --only=nodepools