스팟 인스턴스 - Eksctl 사용 설명서

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

스팟 인스턴스

관리형 노드 그룹

eksctl는 내결함성 애플리케이션이 있는 EKS 고객이 EKS 클러스터에 대한 EC2 스팟 인스턴스를 쉽게 프로비저닝하고 관리할 수 있는 기능인 EKS 관리형 노드 그룹을 사용하여 스팟 워커 노드를 지원합니다. EC2 EKS 관리형 노드 그룹은 스팟 모범 사례에 따라 스팟 인스턴스의 EC2 Autoscaling 그룹을 구성하고 시작하고 인스턴스가 AWS에 의해 중단되기 전에 스팟 작업자 노드를 자동으로 드레이닝합니다. 이 기능을 사용하는 데는 증분 요금이 부과되지 않으며 고객은 EC2 스팟 인스턴스 및 EBS 볼륨과 같은 AWS 리소스 사용에 대해서만 비용을 지불합니다.

스팟 인스턴스를 사용하여 관리형 노드 그룹으로 클러스터를 생성하려면 --spot 플래그와 선택적 인스턴스 유형 목록을 전달합니다.

eksctl create cluster --spot --instance-types=c3.large,c4.large,c5.large

기존 클러스터에서 스팟 인스턴스를 사용하여 관리형 노드 그룹을 생성하려면:

eksctl create nodegroup --cluster=<clusterName> --spot --instance-types=c3.large,c4.large,c5.large

구성 파일을 통해 관리형 노드 그룹을 사용하여 스팟 인스턴스를 생성하려면:

# spot-cluster.yaml apiVersion: eksctl.io/v1alpha5 kind: ClusterConfig metadata: name: spot-cluster region: us-west-2 managedNodeGroups: - name: spot instanceTypes: ["c3.large","c4.large","c5.large","c5d.large","c5n.large","c5a.large"] spot: true # `instanceTypes` defaults to [`m5.large`] - name: spot-2 spot: true # On-Demand instances - name: on-demand instanceTypes: ["c3.large", "c4.large", "c5.large"]
eksctl create cluster -f spot-cluster.yaml
참고

비관리형 노드 그룹은 spotinstanceTypes 필드를 지원하지 않고 대신 instancesDistribution 필드를 사용하여 스팟 인스턴스를 구성합니다. 아래 참조

추가 정보

비관리형 노드 그룹

eksctl는 Auto Scaling 그룹에 대한 MixedInstancesPolicy를 통해 스팟 인스턴스를 지원합니다.

다음은 50% 스팟 인스턴스와 50% 온디맨드 인스턴스를 사용하는 노드 그룹의 예입니다.

nodeGroups: - name: ng-1 minSize: 2 maxSize: 5 instancesDistribution: maxPrice: 0.017 instanceTypes: ["t3.small", "t3.medium"] # At least one instance type should be specified onDemandBaseCapacity: 0 onDemandPercentageAboveBaseCapacity: 50 spotInstancePools: 2

nodeGroups.X.instanceType 필드를 사용할 때는 instancesDistribution 필드를 설정하면 안 됩니다.

이 예제에서는 GPU 인스턴스를 사용합니다.

nodeGroups: - name: ng-gpu instanceType: mixed desiredCapacity: 1 instancesDistribution: instanceTypes: - p2.xlarge - p2.8xlarge - p2.16xlarge maxPrice: 0.50

이 예제에서는 용량 최적화 스팟 할당 전략을 사용합니다.

nodeGroups: - name: ng-capacity-optimized minSize: 2 maxSize: 5 instancesDistribution: maxPrice: 0.017 instanceTypes: ["t3.small", "t3.medium"] # At least one instance type should be specified onDemandBaseCapacity: 0 onDemandPercentageAboveBaseCapacity: 50 spotAllocationStrategy: "capacity-optimized"

이 예제에서는 capacity-optimized-prioritized 지정 스팟 할당 전략을 사용합니다.

nodeGroups: - name: ng-capacity-optimized-prioritized minSize: 2 maxSize: 5 instancesDistribution: maxPrice: 0.017 instanceTypes: ["t3a.small", "t3.small"] # At least two instance types should be specified onDemandBaseCapacity: 0 onDemandPercentageAboveBaseCapacity: 0 spotAllocationStrategy: "capacity-optimized-prioritized"

capacity-optimized-prioritized 할당 전략을 사용한 다음 시작 템플릿 재정의 목록에서 인스턴스 유형 순서를 가장 높은 우선 순위에서 가장 낮은 우선 순위(목록의 첫 번째부터 마지막까지)로 설정합니다. Amazon EC2 Auto Scaling은 최상의 노력으로 인스턴스 유형 우선순위를 준수하지만 먼저 용량을 최적화합니다. 이는 중단 가능성을 최소화해야 하지만 특정 인스턴스 유형에 대한 기본 설정도 중요한 워크로드에 적합한 옵션입니다. 자세한 내용은 ASG 구매 옵션을 참조하세요.

spotInstancePools 필드를 사용할 때는 spotAllocationStrategy 필드를 설정해서는 안 됩니다. spotAllocationStrategy를 지정하지 않으면 EC2는 기본적으로 lowest-price 전략을 사용합니다.

다음은 최소한의 예입니다.

nodeGroups: - name: ng-1 instancesDistribution: instanceTypes: ["t3.small", "t3.medium"] # At least one instance type should be specified

스팟 인스턴스와 온디맨드 인스턴스 간에 노드를 구분하려면 유형에 on-demand 따라 spot 또는 값이 node-lifecycle 있는 kubernetes 레이블을 사용할 수 있습니다.

instancesDistribution의 파라미터

자세한 내용은 클러스터 구성 스키마를 참조하세요.