Stage 10, Part 5 of 9 · p. 87, Autoscaling & Cost Optimization
PART 5: ARCHITECTURE & STRATEGY
20. Cost Governance Architecture
text
┌─────────────────────────────────────────────────────────────┐
│ COST GOVERNANCE STACK │
│ │
│ Layer 1: Visibility │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Kubecost / OpenCost │ │
│ │ • Cost allocation by namespace, label, team │ │
│ │ • Real-time monitoring │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
│ Layer 2: Optimization │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ VPA (Off) + Goldilocks │ │
│ │ • Rightsizing recommendations │ │
│ │ • Historical analysis │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
│ Layer 3: Scaling │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ HPA + KEDA + Karpenter │ │
│ │ • Replica scaling (HPA/KEDA) │ │
│ │ • Node scaling (Karpenter) │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
│ Layer 4: Governance │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ ResourceQuotas + LimitRanges + Budgets │ │
│ │ • Team budgets │ │
│ │ • Resource caps │ │
│ └─────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
21. Multi-Tenant Cost Allocation
Showback vs Chargeback
| Model | Description | Impact |
| Showback | Show teams their costs | Awareness |
| Chargeback | Charge teams for costs | Accountability |
Cost Allocation Labels
yaml
metadata:
labels:
team: platform
cost-center: engineering
environment: production
app: web
ResourceQuotas for Cost Control
yaml
apiVersion: v1
kind: ResourceQuota
metadata:
name: team-budget
namespace: team-a
spec:
hard:
requests.cpu: "100"
requests.memory: 200Gi
limits.cpu: "200"
limits.memory: 400Gi
22. Compliance & Security for Cost Management
| Framework | Requirement |
| SOC2 | Change management, monitoring |
| PCI-DSS | Access controls, audit logs |
| HIPAA | Audit trails, access controls |
| FedRAMP | FIPS 140-2, cost controls |
1:1 copy of the class Google Doc, code in code blocks.