pulumi-eks icon indicating copy to clipboard operation
pulumi-eks copied to clipboard

Unable to choose correct AMI ID if NodeGroup is ARM64

Open danielbichuetti opened this issue 3 years ago • 2 comments

What happened?

When creating an EKS cluster, if you create a new NodeGroup which uses ARM instance (e.g., t4g-medium), creating cluster will fail, with error on EC2 ASG, regarding different AMI arch (x86_64) and node arch.

Steps to reproduce

Create a Pulumi project, use AWS Crosswalk EKS to create cluster and node group.

cluster = Cluster(
    "cluster-on-eks",
    ClusterArgs(
        node_associate_public_ip_address=True,
        create_oidc_provider=True,
        skip_default_node_group=True,
    ),
)

medium_node_group = NodeGroup(
    "cluster-ng1",
    cluster=cluster.core,
    desired_capacity=2,
    instance_type="t4g.medium",
    ami_type="amazon-linux-2-arm64", # Need manually setup when is ARM64
    min_size=1,
    max_size=5,
    #labels={"instance": "medium", "lifecycle": "on-demand", "architecture": "arm64"},
    #taints={"arm": TaintArgs(value="true", effect="PreferNoSchedule")},
    opts=pulumi.ResourceOptions(
        parent=cluster,
        providers={
            "kubernetes": cluster.provider,
        },
    ),
)

Expected Behavior

Cluster and node group of ARM64 type are created

Actual Behavior

Fail to deploy the ASG and NodeGroup.

Failed Scaling Activity: The architecture 'arm64' of the specified instance type does not match the architecture 'x86_64' of the specified AMI. Specify an instance type and an AMI that have matching architectures, and try again. You can use 'describe-instance-types' or 'describe-images' to discover the architecture of the instance type or AMI. Launching EC2 instance failed.

Versions used

pulumi-awsx        1.0.0b9
pulumi-eks         0.41.2

Additional context

Another reference at #582, but it seems to have been addressed.

Contributing

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).

danielbichuetti avatar Jul 18 '22 05:07 danielbichuetti

Thanks for opening the issue @danielbichuetti. Seems surprising since we do lookup the amiID corresponding to the amiType - which I believe you are providing to indicate this is arm64: https://github.com/pulumi/pulumi-eks/blob/62700bf751ae85414e0bd673d2c036cefdd6f2f6/nodejs/eks/nodegroup.ts#L513

@roothorp could you investigate?

viveklak avatar Jul 19 '22 21:07 viveklak

@viveklak I haven't looked deep, but when setting as ARM64 compatible type the GPU AMI is being returned.

danielbichuetti avatar Jul 19 '22 21:07 danielbichuetti

This is still happening with @pulumi/eks 1.0.1 using NodeGroupV2. had to ad amiId manually:

export const nodeGroup = new eks.NodeGroupV2(
  'eks-node-group-1',
  {
    cluster: cluster,

    instanceType: 't4g.small',
    // https://github.com/pulumi/pulumi-eks/issues/738
    // https://docs.aws.amazon.com/eks/latest/userguide/eks-optimized-ami.html
    amiId: 'ami-0553b10628d5da670', // <- had to add this manually
    // https://www.pulumi.com/registry/packages/eks/api-docs/managednodegroup/#inputs
    amiType: 'amazon-linux-2-arm64',

    desiredCapacity: Number(eksConfig.desiredClusterSize),
    minSize: Number(eksConfig.minClusterSize),
    maxSize: Number(eksConfig.maxClusterSize),
    instanceProfile: instanceProfile,
    // spotPrice: "1",
    // labels: {
    //     ondemand: "true",
    // },
  }

rhyek avatar Feb 11 '23 22:02 rhyek

Thanks for opening the issue @danielbichuetti. Seems surprising since we do lookup the amiID corresponding to the amiType - which I believe you are providing to indicate this is arm64:

https://github.com/pulumi/pulumi-eks/blob/62700bf751ae85414e0bd673d2c036cefdd6f2f6/nodejs/eks/nodegroup.ts#L513

@roothorp could you investigate?

Yes but in the case of arm (amiType = amazon-linux-2-arm64), you're end up using the wrong amiType: Either amazon-linux-2-gpu or amazon-linux-2 is set but this should not happen when amazon-linux-2-arm64 has been set.

benbust avatar Mar 30 '23 07:03 benbust

@viveklak @danielbichuetti - there is a PR open to fix this issue here. Could someone from Pulumi take a look, please?

bradyburke avatar Aug 04 '23 14:08 bradyburke

Still an issue with v2.0.0.

To reproduce:

$ pulumi new kubernetes-aws-go

Use t4g.nano or t4g.medium (an ARM Graviton instance type) when running. My stack config is:

environment:
- aws
config:
  aws:region: eu-west-1
  zd-4464:desiredClusterSize: "2"
  zd-4464:eksNodeInstanceType: t4g.nano
  zd-4464:maxClusterSize: "4"
  zd-4464:minClusterSize: "2"
  zd-4464:vpcNetworkCidr: 10.90.0.0/16

Running pulumi up will create an EC2 LaunchConfiguration with AMI ID ami-0e12ff1a3c8cf683d (in region eu-west-1), which is an x86_64 architecture:

Screenshot 2024-01-24 at 15 51 24

Pulumi About

pulumi about
CLI          
Version      3.102.0
Go Version   go1.21.5
Go Compiler  gc

Plugins
NAME        VERSION
aws         6.7.0
awsx        2.1.1
docker      4.4.3
eks         2.0.0
go          unknown
kubernetes  4.4.0

Host     
OS       darwin
Version  14.2.1
Arch     arm64

This project is written in go: executable='/opt/homebrew/bin/go' version='go version go1.21.6 darwin/arm64'

Current Stack: team-ce/zd-4464/ringo

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/v-ringo-pulumi-corp
User           v-ringo-pulumi-corp
Organizations  v-ringo-pulumi-corp, team-ce
Token type     personal

Dependencies:
NAME                                  VERSION
github.com/pulumi/pulumi-awsx/sdk/v2  2.1.1
github.com/pulumi/pulumi-eks/sdk/v2   2.0.0
github.com/pulumi/pulumi/sdk/v3       3.91.1

Pulumi locates its logs in /var/folders/yq/10j1hf8s1ks9f23yxrdbbbb40000gn/T/ by default

ringods avatar Jan 24 '24 14:01 ringods