question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom launch template is not used when creating a new Managed Node Group

See original GitHub issue

Hello!

  • Vote on this issue by adding a 👍 reaction
  • To contribute a fix for this issue, leave a comment (and link to your pull request, if you’ve opened one already)

Issue details

When creating a new Managed Node Group, I specified a custom (ec2) launch template via launchTemplate.

Though, newly launched EC2 instances do not appear to be using this launch template since the EC2 instance tag name aws:ec2launchtemplate:id refers to the one created by this provider instead.

Steps to reproduce

  1. Use https://github.com/pulumi/pulumi-eks/tree/master/examples/managed-nodegroups as a starting point
  2. Create a new launch template as part of your code
const launchTemplate = new aws.ec2.LaunchTemplate("my-launch-template", {
    tags: {testTag: "tag value"},
});
  1. Set the launch template for the managed node group like this
	...
	launchTemplate: {
		id: launchTemplate.id,
		version: '$Latest'
	}
  1. Deploy your changes

Expected: The custom launch template is used to launch new EC2 instances. Actual: The default launch template created by this provider is used.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
nimbinatuscommented, Mar 4, 2022

Reopening this with a question from the community Slack:

Attaching a custom LaunchTemplate to an EKS ManagedNodeGroup doesn’t seem to work? For example, following this: https://github.com/pulumi/pulumi-eks/tree/master/examples/managed-nodegroups. I create a new LaunchTemplate with some metadata options and a key pair, refer to it in the eks.createManagedNodeGroup() args:

launchTemplate: {
 id: pulumi.interpolate`${myLaunchTemplate.id}`,
 version: "1",
},

When the node group comes up, it says on the EKS page that it’s using mine, but on the instances themselves in the ASG, it’s using an auto-created one. Is this a bug? Or am I missing something fundamental?

1reaction
con5ciencecommented, Dec 1, 2021

id is an Output, so you need to interpolate it:

id: pulumi.interpolate`${launchTemplate.id}`

More context:

https://www.pulumi.com/registry/packages/aws/api-docs/ec2/launchtemplate/#outputs https://www.pulumi.com/docs/intro/concepts/inputs-outputs/#outputs-and-strings

It is not recommended to use ‘$Latest’ for the launch template version because the AWS API will this as 1 and parse it as drift every time, causing Pulumi to delete-replace it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Launch template support - Amazon EKS - AWS Documentation
If you deploy a managed node group without using a custom launch template, this value is automatically set for the node group in...
Read more >
Launch Template support for Managed Nodegroups - eksctl
This enables multiple customization options for nodegroups including providing custom AMIs and security groups, and passing user data for node bootstrapping.
Read more >
Using Launch Templates to Create AWS EKS Managed Node ...
Not just that we can create a new version of Launch Template with a new instance type say t2.xlarge and the managed node...
Read more >
Creating a managed node group - Amazon EKS - 亚马逊云科技
If you don't use a custom launch template when first creating a managed node group, don't use one at a later time for...
Read more >
EKS Managed Node Group Module - Terraform Registry
Configuration in this directory creates an EKS Managed Node Group along with ... to providing a custom launch template to allow for custom...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found