Scaling Application
Update : 2025.01.30
1. 애플리케이션 확장 (Scaling Application)
1.1 애플리케이션 배포 (Deploy Application)
① 애플리케이션 배포 (0개의 Replica)
# Karpenter 관련 작업 디렉토리로 이동
cd ~/environment/karpenter
kubectl create namespace karpenter-test
# basic-deploy.yaml 파일을 생성
cat <<EoF> ~/environment/karpenter/basic-deploy.yaml
apiVersion: apps/v1 # API 버전 (Kubernetes에서 사용되는 앱 관련 리소스 정의)
kind: Deployment # 배포(Deployment) 리소스 정의
metadata:
name: inflate # Deployment 이름 지정
namespace: karpenter-test # Deployment가 배포될 네임스페이스 지정
spec:
replicas: 0 # 초기 Pod 개수를 0으로 설정 (추후 스케일링할 예정)
selector:
matchLabels:
app: inflate # 이 Deployment가 관리할 Pod의 label 지정
template: # Pod 템플릿 정의
metadata:
labels:
app: inflate # Pod에 부여될 label (Deployment의 selector와 일치해야 함)
spec:
terminationGracePeriodSeconds: 0 # Pod 종료 대기 시간을 0으로 설정 (즉시 종료)
containers:
- name: inflate # 컨테이너 이름
image: public.ecr.aws/eks-distro/kubernetes/pause:3.7 # 컨테이너 이미지 지정 (pause 컨테이너 사용)
resources:
requests:
cpu: 1 # 이 컨테이너가 요청하는 CPU 리소스 (1 vCPU)
nodeSelector:
eks-team: my-team # 특정 노드 그룹(eks-team: my-team)에서만 실행되도록 지정
EoF
# 위에서 생성한 Deployment를 Kubernetes 클러스터에 적용
kubectl apply -f ~/environment/karpenter/basic-deploy.yaml
② 현재 클러스터의 노드 확인
1.2 애플리케이션 확장 (Scale Application)
① Deployment 스케일링 (0 → 5 Replicas)
② Karpenter 로그 확인
③ 새로운 노드 생성 확인
④ 새롭게 추가된 노드에 Pod이 배치됨 확인
⑤ Karpenter가 생성한 노드의 메타데이터 확인
1.4 Node 축출
① Node 축출 확인
② 왜 노드는 삭제 되었는가?
③ 노드 축출 방법은 아래에서 처럼 Karpenter 에서 활용 가능합니다.
방법
설정 변경
1.5 정리
Last updated