Skip to content

CICD-459 · Resource utilization reporting ​

Encyclopedia · FinOps and resource optimization · All snippets

Previous · CICD-458 · Next · CICD-460

1. Where it fits ​

  • Placement CI metrics report.
  • Prerequisites authorized read reports, explicit pricing period and reviewed ownership for cleanup.
  • Platforms local-linux, github-actions, gitea-actions.

2. Copy the snippet ​

bash
kubectl top pod -n staging --containers | tee usage.txt
test "$(wc -l < usage.txt)" -gt 1

3. How it works ​

The metrics command reads recent utilization samples for the selected scope. A snapshot is insufficient for sizing decisions. The shell predicate makes the expected state explicit and returns a nonzero status when it is not satisfied.

4. Verify the result ​

Requires Metrics Server. Sample over representative periods before using results for rightsizing.

Validation syntax-validated (Bash parse). Status definitions.