Amazon EKS:在竞价型实例上设置工作程序节点

时间:2018-10-19 05:41:21

标签: amazon-web-services amazon-ec2 kubernetes aws-eks

使用AWS EKS时,是否可以在竞价型实例上设置工作节点?

  • 我该怎么办?
  • 在这样的设置下,我有什么需要特别注意的吗?

1 个答案:

答案 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}