翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
スポットインスタンス
マネージド型ノードグループ
eksctl
は、EKS Managed Nodegroups を使用してスポットワーカーノード
スポットインスタンスを使用してマネージド型ノードグループを持つクラスターを作成するには、 --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
注記
アンマネージド型ノードグループは spot
および instanceTypes
フィールドをサポートしておらず、代わりに 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
スポットインスタンスとオンデマンドインスタンス間でノードを区別するには、kubernetes ラベルを使用します。node-lifecycle
kubernetes ラベルには、そのタイプon-demand
に応じて spot
または の値があります。
instancesDistribution のパラメータ
詳細については、クラスター設定スキーマを参照してください。