Spot 인스턴스 전략
Spot vs On-Demand 혼합 전략
# spot-ondemand-mixed.yaml
apiVersion: karpenter.sh/v1
kind: NodePool
metadata:
name: mixed-capacity
spec:
template:
spec:
requirements:
- key: karpenter.k8s.aws/instance-category
operator: In
values: ["m", "c", "r"]
- key: karpenter.k8s.aws/instance-generation
operator: Gt
values: ["5"]
# Spot과 On-Demand 모두 허용
- key: karpenter.sh/capacity-type
operator: In
values: ["spot", "on-demand"]
nodeClassRef:
group: eks.amazonaws.com
kind: NodeClass
name: default
disruption:
consolidationPolicy: WhenEmptyOrUnderutilized
consolidateAfter: 1m
---
# Pod에서 Spot 선호 설정
apiVersion: apps/v1
kind: Deployment
metadata:
name: spot-friendly-app
spec:
replicas: 10
selector:
matchLabels:
app: spot-friendly
template:
metadata:
labels:
app: spot-friendly
spec:
# Spot 인스턴스 선호
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
preference:
matchExpressions:
- key: karpenter.sh/capacity-type
operator: In
values: ["spot"]
# 중요 워크로드는 On-Demand 필수
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: karpenter.sh/capacity-type
# operator: In
# values: ["on-demand"]
containers:
- name: app
image: my-app:latest
resources:
requests:
cpu: 500m
memory: 512MiSpot 인스턴스 다양화
Spot 인터럽트 대응
워크로드별 Spot 적합성
워크로드 유형
Spot 적합성
권장 설정
비용 절감 사례
Spot 인터럽트 핸들링 모범 사례
1. 애플리케이션 레벨 대응
2. 클러스터 레벨 대응
마지막 업데이트