我有一个CloudFormation模板,用于创建受管节点组:
NodeGroup:
Type: AWS::EKS::Nodegroup
Properties:
ClusterName: !Ref Cluster
InstanceTypes:
- !Ref NodeInstanceClass
NodegroupName: ng-0
NodeRole: !GetAtt NodeInstanceRole.Arn
ScalingConfig:
MinSize: !Ref ClusterMinSize
DesiredSize: !Ref ClusterDesiredSize
MaxSize: !Ref ClusterMaxSize
Subnets:
- !Ref AppSubnetID1
- !Ref AppSubnetID2
问题:有没有办法让节点创建的其 EBS卷被加密?
可能在某个地方提供了加密的AMI?
答案 0 :(得分:1)
基于EKS,我们需要为k8s集群制作加密的PV / PVC。
此在线教程包含以下步骤:
https://prabhatsharma.in/blog/using-encrypted-ebs-volumes-on-kubernetes-with-aws/
这只会向您展示如何在k8s中进行操作。
我们需要使其适应EKS Cloudformation模板。
我们可以通过在此处使用EKS Cluster加密提供程序的相关CloudFormation标签来完成此操作:
您将需要设置以下参数:
Type: AWS::EKS::Cluster
Properties:
EncryptionConfig:
Provider:
Provider
Resources:
- String
Name: String
ResourcesVpcConfig:
ResourcesVpcConfig
RoleArn: String
Version: String
请注意,这是在AWS :: EKS :: Cluster中完成的,而不是通过EncryptionConfig在NodeGroup中完成的。
属性 提供者 群集的加密提供程序。
必填:否
类型:提供商
资源 指定要加密的资源。唯一受支持的值为“秘密”。
必填:否
类型:字符串列表
答案 1 :(得分:1)
启用default encryption for EBS volumes on your AWS account's EC2 settings。这会导致默认情况下创建的所有 EBS 卷都是加密的。
另一种选择是使用 launch template:
NodeGroup:
Type: AWS::EKS::Nodegroup
Properties:
ClusterName: !Ref Cluster
InstanceTypes:
- !Ref NodeInstanceClass
NodegroupName: ng-0
LaunchTemplate:
Version: !GetAtt NodeLaunchTemplate.LatestVersionNumber
Id: !Ref NodeLaunchTemplate
NodeRole: !GetAtt NodeInstanceRole.Arn
ScalingConfig:
MinSize: !Ref ClusterMinSize
DesiredSize: !Ref ClusterDesiredSize
MaxSize: !Ref ClusterMaxSize
Subnets:
- !Ref AppSubnetID1
- !Ref AppSubnetID2
NodeLaunchTemplate:
Type: AWS::EC2::LaunchTemplate
Properties:
LaunchTemplateData:
BlockDeviceMappings:
- DeviceName: /dev/xvda
Ebs:
VolumeSize: !Ref NodeVolumeSize
VolumeType: gp3
Encrypted: true
DeleteOnTermination: true
KeyName: !Ref KeyName
NetworkInterfaces:
- DeviceIndex: 0
Groups:
- !Ref NodeSecurityGroup
LaunchTemplateName: !Sub ${Cluster}-${NodeGroupName}-template