victorious-architect-78054
11/05/2024, 10:36 AMlaunchTemplate, err := ec2.NewLaunchTemplate(ctx, fmt.Sprintf("%s-eks-launch-template", environment), &ec2.LaunchTemplateArgs{
Name: pulumi.Sprintf("%s-eks-launch-template", environment),
Tags: defaultTags,
DefaultVersion: pulumi.Int(1),
BlockDeviceMappings: ec2.LaunchTemplateBlockDeviceMappingArray{
&ec2.LaunchTemplateBlockDeviceMappingArgs{
DeviceName: pulumi.String("/dev/xvda"),
Ebs: &ec2.LaunchTemplateBlockDeviceMappingEbsArgs{
DeleteOnTermination: pulumi.String("true"),
VolumeSize: pulumi.Int(20), // 20 GB volume
Encrypted: pulumi.String("true"),
VolumeType: pulumi.String("gp2"),
KmsKeyId: pulumi.String(key.Arn),
},
},
},
})
eks.NewManagedNodeGroup(ctx, fmt.Sprintf("%s-eks-managed-node-group", environment), &eks.ManagedNodeGroupArgs{
NodeGroupName: pulumi.Sprintf("%s-eks-managed-node-group", environment),
Cluster: eksCluster,
ClusterName: eksClusterName,
NodeRoleArn: executionRole.Arn,
SubnetIds: privateSubnets,
LaunchTemplate: &classicEKS.NodeGroupLaunchTemplateArgs{
Id: launchTemplate.ID(),
Version: pulumi.String("$Latest"),
},
ScalingConfig: &classicEKS.NodeGroupScalingConfigArgs{
DesiredSize: pulumi.Int(minSize),
MaxSize: pulumi.Int(minSize * 2),
MinSize: pulumi.Int(minSize),
},
CapacityType: pulumi.String(capacityType),
AmiType: pulumi.String("BOTTLEROCKET_x86_64"),
Version: pulumi.String("1.31"),
InstanceTypes: pulumi.StringArray{
pulumi.String(instanceType),
},
Tags: defaultTags,
})
But this is just creating another volumes and templates and keep existing default templates and volumes
(like explained here: https://stackoverflow.com/questions/76653246/terraform-aws-creates-two-launch-templates-while-creating-eks-cluster-managed)
what is the correct way to handle this ?quick-house-41860
11/05/2024, 2:09 PMlatestVersion
output of launchTemplate
?
That should correctly work IIRCvictorious-architect-78054
11/05/2024, 4:15 PMvictorious-architect-78054
11/05/2024, 4:15 PM_, err := ebs.NewEncryptionByDefault(ctx, "ebs-encryption-default", &ebs.EncryptionByDefaultArgs{
Enabled: pulumi.Bool(true),
})
victorious-architect-78054
11/05/2024, 4:17 PMvictorious-architect-78054
11/05/2024, 4:18 PMlaunchTemplate, err := ec2.NewLaunchTemplate(ctx, fmt.Sprintf("%s-eks-launch-template", environment), &ec2.LaunchTemplateArgs{
Name: pulumi.Sprintf("%s-eks-launch-template", environment),
Tags: defaultTags,
DefaultVersion: <http://pulumi.Int|pulumi.Int>(1),
BlockDeviceMappings: ec2.LaunchTemplateBlockDeviceMappingArray{
&ec2.LaunchTemplateBlockDeviceMappingArgs{
DeviceName: pulumi.String("/dev/xvda"),
Ebs: &ec2.LaunchTemplateBlockDeviceMappingEbsArgs{
DeleteOnTermination: pulumi.String("true"),
VolumeSize: <http://pulumi.Int|pulumi.Int>(2), // 2 GB volume
Encrypted: pulumi.String("true"),
VolumeType: pulumi.String("gp2"),
KmsKeyId: pulumi.String(key.Arn),
},
},
&ec2.LaunchTemplateBlockDeviceMappingArgs{
DeviceName: pulumi.String("/dev/xvdb"),
Ebs: &ec2.LaunchTemplateBlockDeviceMappingEbsArgs{
DeleteOnTermination: pulumi.String("true"),
VolumeSize: <http://pulumi.Int|pulumi.Int>(20), // 20 GB volume
Encrypted: pulumi.String("true"),
VolumeType: pulumi.String("gp2"),
KmsKeyId: pulumi.String(key.Arn),
},
},
},
})
victorious-architect-78054
11/05/2024, 4:18 PMquick-house-41860
11/05/2024, 4:22 PMquick-house-41860
11/05/2024, 4:24 PM"/dev/xvdb"
is the data volume. In case you need more storage on that node you should increase the size of that onevictorious-architect-78054
11/05/2024, 4:26 PMvictorious-architect-78054
11/05/2024, 4:27 PMvictorious-architect-78054
11/05/2024, 4:27 PMquick-house-41860
11/05/2024, 4:29 PM