使用AWS EKS
时,是否可以在竞价型实例上设置工作节点?
答案 0 :(得分:2)
是的,您可以在LaunchConfiguration
部分中修改Cloudformation Template(在此document中提到),以指定现货价格。
NodeLaunchConfig:
Type: AWS::AutoScaling::LaunchConfiguration
Properties:
SpotPrice: "20" # <=== Here
AssociatePublicIpAddress: 'true'
IamInstanceProfile: !Ref NodeInstanceProfile
ImageId: !Ref NodeImageId
InstanceType: !Ref NodeInstanceType
KeyName: !Ref KeyName
SecurityGroups:
- !Ref NodeSecurityGroup
BlockDeviceMappings:
- DeviceName: /dev/xvda
Ebs:
VolumeSize: !Ref NodeVolumeSize
VolumeType: gp2
DeleteOnTermination: true
UserData:
Fn::Base64:
!Sub |
#!/bin/bash
set -o xtrace
/etc/eks/bootstrap.sh ${ClusterName} ${BootstrapArguments}
/opt/aws/bin/cfn-signal --exit-code $? \
--stack ${AWS::StackName} \
--resource NodeGroup \
--region ${AWS::Region}