[Bug] eksctl get nodegroup fails to return StackName for a single nodegroup
What were you trying to accomplish?
Retrieve the StackName of a specific managed nodegroup in EKS using eksctl get nodegroup with the --name flag.
What happened?
eksctl failed to retrieve the StackName of a nodegroup when using the --name flag
$ eksctl get nodegroup --cluster $ClusterName --name vmga-nonprod --profile $AWSProfile --region $RegionName -o yaml
- AutoScalingGroupName: eks-xxx
Cluster: vmga-sandbox-eks-cluster
CreationTime: "2021-11-19T21:55:32.058Z"
DesiredCapacity: 2
ImageID: AL2_x86_64
InstanceType: t3.medium
MaxSize: 3
MinSize: 1
Name: vmga-nonprod
NodeInstanceRoleARN: arn:aws:iam::xxx:role/eksctl-vmga-sandbox-eks-cluster-n-NodeInstanceRole-xxx
StackName: ""
Status: ACTIVE
Type: managed
Version: "1.20"
Excluding the --name flag, however, successfully returns the StackName for all nodegroups in the cluster
$ eksctl get nodegroup --cluster $ClusterName --profile $AWSProfile --region $RegionName -o yaml
- AutoScalingGroupName: eks-xxx
Cluster: vmga-sandbox-eks-cluster
CreationTime: "2021-11-19T21:40:36.825Z"
DesiredCapacity: 4
ImageID: AL2_x86_64
InstanceType: t3.small
MaxSize: 6
MinSize: 2
Name: vmga-lb-nodes
NodeInstanceRoleARN: arn:aws:iam::xxx:role/eksctl-vmga-sandbox-eks-cluster-n-NodeInstanceRole-xxx
StackName: eksctl-vmga-sandbox-eks-cluster-nodegroup-vmga-lb-nodes
Status: ACTIVE
Type: managed
Version: "1.20"
- AutoScalingGroupName: eks-xxx
Cluster: vmga-sandbox-eks-cluster
CreationTime: "2021-11-19T21:55:32.058Z"
DesiredCapacity: 2
ImageID: AL2_x86_64
InstanceType: t3.medium
MaxSize: 3
MinSize: 1
Name: vmga-nonprod
NodeInstanceRoleARN: arn:aws:iam::xxx:role/eksctl-vmga-sandbox-eks-cluster-n-NodeInstanceRole-xxx
StackName: eksctl-vmga-sandbox-eks-cluster-nodegroup-vmga-nonprod
Status: ACTIVE
Type: managed
Version: "1.20"
- AutoScalingGroupName: eks-xxx
Cluster: vmga-sandbox-eks-cluster
CreationTime: "2021-11-19T21:59:57.59Z"
DesiredCapacity: 1
ImageID: AL2_x86_64
InstanceType: t3.xlarge
MaxSize: 2
MinSize: 1
Name: vmga-nonprod-load
NodeInstanceRoleARN: arn:aws:iam::xxx:role/eksctl-vmga-sandbox-eks-cluster-n-NodeInstanceRole-xxx
StackName: eksctl-vmga-sandbox-eks-cluster-nodegroup-vmga-nonprod-load
Status: ACTIVE
Type: managed
Version: "1.20"
- AutoScalingGroupName: eks-xxx
Cluster: vmga-sandbox-eks-cluster
CreationTime: "2021-11-19T22:04:24.568Z"
DesiredCapacity: 1
ImageID: AL2_x86_64
InstanceType: t3.xlarge
MaxSize: 2
MinSize: 1
Name: vmga-nonprod-reporting
NodeInstanceRoleARN: arn:aws:iam::xxx:role/eksctl-vmga-sandbox-eks-cluster-n-NodeInstanceRole-xxx
StackName: eksctl-vmga-sandbox-eks-cluster-nodegroup-vmga-nonprod-reporting
Status: ACTIVE
Type: managed
Version: "1.20"
How to reproduce it?
Use eksctl to try and retrieve a managed nodegroup created by eksctl.
Logs
Verbose output (Single nodegroup):
$ eksctl get nodegroup --cluster $ClusterName --name vmga-nonprod --profile $AWSProfile --region $RegionName -o yaml -v 4
2022-07-26 13:56:54 [▶] role ARN for the current session is "arn:aws:iam::xxx:user/[email protected]"
2022-07-26 13:56:55 [▶] cluster = &types.Cluster{Arn:(*string)(0xc000942ed0), CertificateAuthority:(*types.Certificate)(0xc000942ea0), ClientRequestToken:(*string)(nil), ConnectorConfig:(*types.ConnectorConfigResponse)(nil), CreatedAt:time.Date(2021, time.November, 19, 21, 15, 10, 923000000, time.UTC), EncryptionConfig:[]types.EncryptionConfig(nil), Endpoint:(*string)(0xc000942dc0), Identity:(*types.Identity)(0xc000942e70), KubernetesNetworkConfig:(*types.KubernetesNetworkConfigResponse)(0xc001244990), Logging:(*types.Logging)(0xc000e0eb00), Name:(*string)(0xc000942d80), PlatformVersion:(*string)(0xc000942da0), ResourcesVpcConfig:(*types.VpcConfigResponse)(0xc0002c4380), RoleArn:(*string)(0xc000942d90), Status:"ACTIVE", Tags:map[string]string{"alpha.eksctl.io/cluster-name":"vmga-sandbox-eks-cluster", "alpha.eksctl.io/eksctl-version":"0.74.0", "aws:cloudformation:logical-id":"ControlPlane", "aws:cloudformation:stack-id":"arn:aws:cloudformation:us-east-2:xxx:stack/eksctl-vmga-sandbox-eks-cluster-cluster/xxx", "aws:cloudformation:stack-name":"eksctl-vmga-sandbox-eks-cluster-cluster", "eksctl.cluster.k8s.io/v1alpha1/cluster-name":"vmga-sandbox-eks-cluster"}, Version:(*string)(0xc000942db0), noSmithyDocumentSerde:document.NoSerde{}}
- AutoScalingGroupName: eks-xxx
Cluster: vmga-sandbox-eks-cluster
CreationTime: "2021-11-19T21:55:32.058Z"
DesiredCapacity: 2
ImageID: AL2_x86_64
InstanceType: t3.medium
MaxSize: 3
MinSize: 1
Name: vmga-nonprod
NodeInstanceRoleARN: arn:aws:iam::xxx:role/eksctl-vmga-sandbox-eks-cluster-n-NodeInstanceRole-xxx
StackName: ""
Status: ACTIVE
Type: managed
Version: "1.20"
Verbose output (All nodegroups):
$ eksctl get nodegroup --cluster $ClusterName --profile $AWSProfile --region $RegionName -o yaml -v 4
2022-07-26 13:57:29 [▶] role ARN for the current session is "arn:aws:iam::xxx:user/[email protected]"
2022-07-26 13:57:29 [▶] cluster = &types.Cluster{Arn:(*string)(0xc0009a77c0), CertificateAuthority:(*types.Certificate)(0xc0009a7790), ClientRequestToken:(*string)(nil), ConnectorConfig:(*types.ConnectorConfigResponse)(nil), CreatedAt:time.Date(2021, time.November, 19, 21, 15, 10, 923000000, time.UTC), EncryptionConfig:[]types.EncryptionConfig(nil), Endpoint:(*string)(0xc0009a7700), Identity:(*types.Identity)(0xc0009a76d0), KubernetesNetworkConfig:(*types.KubernetesNetworkConfigResponse)(0xc001038900), Logging:(*types.Logging)(0xc000353e20), Name:(*string)(0xc0009a7720), PlatformVersion:(*string)(0xc0009a77b0), ResourcesVpcConfig:(*types.VpcConfigResponse)(0xc000d9d9d0), RoleArn:(*string)(0xc0009a7730), Status:"ACTIVE", Tags:map[string]string{"alpha.eksctl.io/cluster-name":"vmga-sandbox-eks-cluster", "alpha.eksctl.io/eksctl-version":"0.74.0", "aws:cloudformation:logical-id":"ControlPlane", "aws:cloudformation:stack-id":"arn:aws:cloudformation:us-east-2:xxx:stack/eksctl-vmga-sandbox-eks-cluster-cluster/xxx", "aws:cloudformation:stack-name":"eksctl-vmga-sandbox-eks-cluster-cluster", "eksctl.cluster.k8s.io/v1alpha1/cluster-name":"vmga-sandbox-eks-cluster"}, Version:(*string)(0xc0009a77d0), noSmithyDocumentSerde:document.NoSerde{}}
2022-07-26 13:57:30 [▶] nodegroups = [0xc0011bafc0 0xc00111d0e0 0xc0011bbc20 0xc00111dd40]
- AutoScalingGroupName: eks-xxx
Cluster: vmga-sandbox-eks-cluster
CreationTime: "2021-11-19T21:40:36.825Z"
DesiredCapacity: 4
ImageID: AL2_x86_64
InstanceType: t3.small
MaxSize: 6
MinSize: 2
Name: vmga-lb-nodes
NodeInstanceRoleARN: arn:aws:iam::xxx:role/eksctl-vmga-sandbox-eks-cluster-n-NodeInstanceRole-xxx
StackName: eksctl-vmga-sandbox-eks-cluster-nodegroup-vmga-lb-nodes
Status: ACTIVE
Type: managed
Version: "1.20"
- AutoScalingGroupName: eks-xxx
Cluster: vmga-sandbox-eks-cluster
CreationTime: "2021-11-19T21:55:32.058Z"
DesiredCapacity: 2
ImageID: AL2_x86_64
InstanceType: t3.medium
MaxSize: 3
MinSize: 1
Name: vmga-nonprod
NodeInstanceRoleARN: arn:aws:iam::xxx:role/eksctl-vmga-sandbox-eks-cluster-n-NodeInstanceRole-xxx
StackName: eksctl-vmga-sandbox-eks-cluster-nodegroup-vmga-nonprod
Status: ACTIVE
Type: managed
Version: "1.20"
- AutoScalingGroupName: eks-xxx
Cluster: vmga-sandbox-eks-cluster
CreationTime: "2021-11-19T21:59:57.59Z"
DesiredCapacity: 1
ImageID: AL2_x86_64
InstanceType: t3.xlarge
MaxSize: 2
MinSize: 1
Name: vmga-nonprod-load
NodeInstanceRoleARN: arn:aws:iam::xxx:role/eksctl-vmga-sandbox-eks-cluster-n-NodeInstanceRole-xxx
StackName: eksctl-vmga-sandbox-eks-cluster-nodegroup-vmga-nonprod-load
Status: ACTIVE
Type: managed
Version: "1.20"
- AutoScalingGroupName: eks-xxx
Cluster: vmga-sandbox-eks-cluster
CreationTime: "2021-11-19T22:04:24.568Z"
DesiredCapacity: 1
ImageID: AL2_x86_64
InstanceType: t3.xlarge
MaxSize: 2
MinSize: 1
Name: vmga-nonprod-reporting
NodeInstanceRoleARN: arn:aws:iam::xxx:role/eksctl-vmga-sandbox-eks-cluster-n-NodeInstanceRole-xxx
StackName: eksctl-vmga-sandbox-eks-cluster-nodegroup-vmga-nonprod-reporting
Status: ACTIVE
Type: managed
Version: "1.20"
Anything else we need to know?
The StackName is returned for all nodegroups in a cluster when the nodegroups were created by eksctl. For nodegroups not created by eksctl, however, eksctl isn't returning the StackName regardless of whether I use the --name flag. I'll create a separate issue for that soon.
Versions
$ eksctl info
eksctl version: 0.106.0
kubectl version: v1.21.12
OS: linux
@CrisNevares thanks for reporting this issue with a nicely detailed description 🎉 we'll investigate and aim to fix this soon.