展示HN:我审计了500个K8s Pod。Java浪费约48%的内存,Go浪费约18%。
Show HN: I audited 500 K8s pods. Java wastes ~48% RAM, Go ~18%

原始链接: https://github.com/WozzHQ/wozz

## Wozz Kubernetes 审计:查找并减少云端浪费 Wozz 是一个脚本,用于识别 Kubernetes 集群中过度配置的资源,帮助您降低云成本。它分析 Pod 配置,找出请求资源(CPU、内存)和实际使用情况之间的差异,并估算潜在的节省,通常集群的节省率在 30-60%。 该脚本通过 `curl -sL wozz.io/audit.sh | bash` 在本地运行,提供按类别(内存、CPU、负载均衡器、卷)划分的浪费情况细分,并突出显示浪费最多的 Pod。它使用 `kubectl top` 获取准确的使用数据(需要 metrics-server),如果不可用,则回退到请求/限制比较。 **主要特点:** * **无需注册/代理:** 完全在本地运行。 * **只读:** 不修改集群。 * **可选仪表盘:** 推送结果以进行历史趋势和告警。 * **开源:** 可检查代码。 * **成本估算:** 基于平均云定价。 Wozz 识别出常见的过度请求内存/CPU 和孤立资源等问题,提供每月每个 Pod 节省 $5-$50 的潜力。它需要 `kubectl` 访问权限,并可选地使用 `jq` 进行详细分析。

## Wozz:Kubernetes 内存使用审计 一篇最近的 Hacker News 帖子详细介绍了一个名为“Wozz”的工具,用于分析 Kubernetes (K8s) pod 在 500 个部署中的内存使用情况。作者是一位专门从事 K8s 成本优化的顾问,他发现常见的现象是内存过度配置,这源于对应用程序崩溃的担忧。 审计显示,不同语言的内存“浪费”(已分配与已使用)存在显著差异:Python 平均浪费 60%,Java 48%,而 Go 仅为 18%。讨论的重点在于未使用的内存是否真的“浪费”——一些人认为它为流量高峰提供了必要的缓冲空间。 人们对该工具的安装方法(curl | bash)和潜在的安全风险表示担忧。另一些人指出,Java 的默认设置通常会导致过度分配,而 Go 和 Python 则更容易将内存返回给操作系统。该工具是开源的,旨在通过突出请求内存和实际使用内存之间的差距来帮助识别成本节省。
相关文章

原文

Find over-provisioned resources in your K8s cluster. See exactly what you're wasting.

Stars License


curl -sL wozz.io/audit.sh | bash

See your waste breakdown instantly. No signup. No agents. Runs locally.


Most K8s clusters over-provision CPU and memory by 30-60%. This script analyzes your pod resource configs and shows you the gap.

# What teams typically set:
resources:
  limits:
    memory: "4Gi"
    cpu: "1"

# What the app actually needs:
# memory: ~800Mi
# cpu: ~200m

Wozz finds these gaps and estimates the cost.


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
WOZZ KUBERNETES AUDIT
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

💰 ANNUAL WASTE DETECTED: $14,880
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Breakdown by Category:
  Memory: $840/mo ($10,080/year)
  CPU: $360/mo ($4,320/year)
  Load Balancers: $40/mo ($480/year) — 2 orphaned

🎯 #1 Biggest Waster:
  Pod: api-gateway
  Namespace: production
  💸 Wasting: $8,400/year
  
  💡 Fix: Lower memory request to match actual usage

Issue Description Typical Savings
Over-provisioned memory Requests > Actual Usage (kubectl top) $5-50/pod/month
Over-provisioned CPU Requests > Actual Usage (kubectl top) $5-30/pod/month
Orphaned load balancers LBs with no backend ~$20/month each
Unbound volumes PVs not attached ~$10/100GB/month

Note: Requires metrics-server for accurate usage data. Falls back to request/limit analysis if metrics unavailable.


Runs these read-only kubectl commands:

kubectl get pods --all-namespaces -o json
kubectl get nodes -o json
kubectl get pv -o json
kubectl get svc --all-namespaces -o json
kubectl top pods --all-namespaces  # For actual usage metrics

Analysis Method:

  • With metrics-server: Compares actual pod usage (kubectl top) vs resource requests
  • Without metrics-server: Falls back to comparing requests vs limits

No writes. No modifications. No agents installed.


Push results to view in a dashboard:

curl -sL wozz.io/audit.sh | bash -s -- --push

Dashboard features:

  • Namespace breakdown
  • Historical trends
  • PDF export
  • Alerts when waste increases

  • Runs locally - All analysis happens on your machine
  • Optional upload - Only sends data if you use --push
  • No agents - Just standard kubectl commands
  • Open source - Inspect the code yourself

Disable telemetry: WOZZ_NO_TELEMETRY=1


Uses conservative cloud pricing averages:

Resource Cost Source
Memory $7.20/GB/month AWS/GCP/Azure avg
CPU $21.60/core/month AWS/GCP/Azure avg
Storage $0.10/GB/month EBS gp3 / PD-SSD
Load Balancer $20/month ALB/NLB avg

Your actual costs may vary with reserved instances, spot pricing, etc.


  • kubectl configured with cluster access
  • curl
  • jq (optional, for detailed analysis)

# Basic audit (local only)
curl -sL wozz.io/audit.sh | bash

# Push to dashboard
curl -sL wozz.io/audit.sh | bash -s -- --push

# With API token (saves to your account)
curl -sL wozz.io/audit.sh | bash -s -- --push --token YOUR_TOKEN

# Disable telemetry
WOZZ_NO_TELEMETRY=1 curl -sL wozz.io/audit.sh | bash

Download and inspect first:

curl -o wozz-audit.sh https://wozz.io/audit.sh
cat wozz-audit.sh
bash wozz-audit.sh


MIT - See LICENSE


PRs welcome. See CONTRIBUTING.md.

联系我们 contact @ memedata.com