비용 관리
비용 최적화 기본 원칙
# cost-optimization-best-practices.yaml
apiVersion: karpenter.sh/v1
kind: NodePool
metadata:
name: cost-optimized
spec:
template:
spec:
requirements:
# 1. 다양한 인스턴스 패밀리 허용
- key: karpenter.k8s.aws/instance-category
operator: In
values: ["m", "c", "r", "i", "d"]
# 2. Graviton (ARM) 인스턴스 포함 (20% 저렴)
- key: kubernetes.io/arch
operator: In
values: ["amd64", "arm64"]
# 3. Spot 인스턴스 우선
- key: karpenter.sh/capacity-type
operator: In
values: ["spot", "on-demand"]
nodeClassRef:
group: eks.amazonaws.com
kind: NodeClass
name: default
# 4. 적극적인 Consolidation
disruption:
consolidationPolicy: WhenEmptyOrUnderutilized
consolidateAfter: 1m
---
# 비용 최적화를 위한 Pod 설정
apiVersion: apps/v1
kind: Deployment
metadata:
name: cost-efficient-app
spec:
replicas: 5
selector:
matchLabels:
app: cost-efficient
template:
metadata:
labels:
app: cost-efficient
spec:
# Spot 선호
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
preference:
matchExpressions:
- key: karpenter.sh/capacity-type
operator: In
values: ["spot"]
# 적절한 리소스 요청 (오버프로비저닝 방지)
containers:
- name: app
image: my-app:latest
resources:
requests:
cpu: 250m # 실제 사용량 기반
memory: 256Mi
limits:
cpu: 500m
memory: 512Mi비용 분석 대시보드
CloudWatch 기반 비용 대시보드
Kubecost 통합
비용 할당 태깅
Spot 인스턴스 절감 효과 측정
Spot 절감률 계산
Spot 인터럽트 비용 영향 분석
리소스 적정 크기 분석
VPA를 활용한 리소스 추천
리소스 사용량 분석 스크립트
오버프로비저닝 감지
Savings Plans 및 Reserved Instances 전략
Auto Mode와 Savings Plans 통합
전략
설명
권장 비율
Savings Plans 적용 전략
Savings Plans 구매 가이드
비용 최적화 권장 사항 요약
영역
권장 사항
예상 절감
마지막 업데이트