创建EKS辅助节点时如何在云形成模板中指定现有节点安全组

时间:2019-08-19 12:20:29

标签: amazon-web-services kubernetes amazon-cloudformation eks

我想用EKS集群中的现有节点安全组创建EKS辅助节点。

当前,通过以下cloudformation template,使用新的安全组创建EKS工作节点。

如何为我的工作节点引用先前存在的节点安全组?

1 个答案:

答案 0 :(得分:0)

Arundathi,我将使用相同的模板进行解释。

正在此模板(#L200)中创建NodeSecurityGroup。如果要使用现有的安全组,则可以将其用作用户输入,就像ClusterControlPlaneSecurityGroup(#L136):

  ClusterControlPlaneSecurityGroup:
    Description: The security group of the cluster control plane.
    Type: AWS::EC2::SecurityGroup::Id

然后,在需要的任何地方引用它(#L226)。例如:

  NodeSecurityGroupFromControlPlaneIngress:
    Type: AWS::EC2::SecurityGroupIngress
    DependsOn: NodeSecurityGroup
    Properties:
      Description: Allow worker Kubelets and pods to receive communication from the cluster control plane
      GroupId: !Ref NodeSecurityGroup
      SourceSecurityGroupId: !Ref ClusterControlPlaneSecurityGroup
      IpProtocol: tcp
      FromPort: 1025
      ToPort: 65535

让我知道您是否还有任何疑问。