AWS Ubuntu Managed nodeGroup instances failing to join kubernetes cluster

0

Hi, I am trying to launch ManagedNodeGroup with Ubuntu amiFamily. but due to some reason it is failing to create managedNodeGroup. Below is my config

managedNodeGroups:
  - name: serv-test-1
    amiFamily: Ubuntu2004
    instanceType: m5.xlarge
    desiredCapacity: 1
    volumeType: gp2
    volumeSize: 50
    privateNetworking: true
    subnets:
      - hscn-private2-subnet
    ssh:
      allow: true
    labels:
      role: serv

Just to add that I have created self-managed node group and it is joining my cluster successfully. The thing is I am working behind the proxy and I want to add UserData through overridebootstrap command. but whenever I add the overrideBootstrap flag it says "you must specify custom ami", and when I add custom ami then it says "can't specify amiFamily flag with custom ami" But in order to create ubuntu managed node instance it is necessary to specify amiFamily otherwise it will create AmazonLinux instance.

2 Answers
0

Hello there,

For managed nodes with custom AMI, the overrideBootstrapCommand is required. For unmanaged nodes overrideBootstrapCommand is recommended for AmazonLinux2 and Ubuntu custom images.

Don't use amiFamily: Ubuntu2004, instead used ami: ami-0feb1a4a4e739ea4e. You can get the latest Ubuntu image from https://cloud-images.ubuntu.com/aws-eks/. The overrideBootstrapCommand can only be set when a custom AMI with managedNodeGroups[0].ami is specified.

managedNodeGroups:
  - name: serv-test-1
    ami: ami-0feb1a4a4e739ea4e
    instanceType: m5.xlarge
    overrideBootstrapCommand: |
      #!/bin/bash
      /etc/eks/bootstrap.sh <cluster-name>

For more, see https://eksctl.io/usage/custom-ami-support/

answered 2 months ago
  • Hi @Olawale. I have tried the config that you mentioned above.

    managedNodeGroups:
      - name: serv-test-1
        #amiFamily: Ubuntu2004
        ami: ami-0ebb49de26355a371
        instanceType: m5.xlarge
        desiredCapacity: 1
        volumeType: gp2
        volumeSize: 50
        privateNetworking: true
        subnets:
          - hscn-private2-subnet
        ssh:
          allow: true
        overrideBootstrapCommand: |
          #!/bin/bash
          /etc/eks/bootstrap.sh test-cluster
    
  • When I used the above config I got the following logs

    2022-09-30 08:09:37 [ℹ]  nodegroup "serv-test-1" will use "ami-0ebb49de26355a371" [AmazonLinux2/1.23]
    2022-09-30 08:09:37 [ℹ]  using SSH public key "/home/ubuntu/.ssh/id_rsa.pub" as "eksctl-test-cluster-nodegroup-serv-test-1-56:df:6f:6e:ca:62:a0:f8:7e:4b:18:35:e6:84:85:0a" 
    2022-09-30 08:09:37 [ℹ]  1 nodegroup (serv-test-1) was included (based on the include/exclude rules)
    2022-09-30 08:09:37 [ℹ]  will create a CloudFormation stack for each of 1 managed nodegroups in cluster "test-cluster"
    2022-09-30 08:09:37 [ℹ]  
    2 sequential tasks: { fix cluster compatibility, 1 task: { 1 task: { create managed nodegroup "serv-test-1" } } 
    }
    2022-09-30 08:09:37 [ℹ]  checking cluster stack for missing resources
    2022-09-30 08:09:38 [ℹ]  cluster stack has all required resources
    2022-09-30 08:09:38 [ℹ]  building managed nodegroup stack "eksctl-test-cluster-nodegroup-serv-test-1"
    2022-09-30 08:09:38 [ℹ]  deploying stack "eksctl-test-cluster-nodegroup-serv-test-1"
    2022-09-30 08:09:38 [ℹ]  waiting for CloudFormation stack "eksctl-test-cluster-nodegroup-serv-test-1"
    2022-09-30 08:34:08 [ℹ]  1 error(s) occurred and nodegroups haven't been created properly, you may wish to check CloudFormation console
    2022-09-30 08:34:08 [✖]  exceeded max wait time for StackCreateComplete waiter
    Error: failed to create nodegroups for cluster "test-cluster"
    
  • The most annoying thing is that when I specify only ami instead of amiFamily it only uses [AmazonLinux2/1.23] not the Ubuntu. but as I am working behind the proxy so I also tried the following full command

    overrideBootstrapCommand: |
          #!/bin/bash
          /etc/eks/bootstrap.sh test-cluster --kubelet-extra-args '--node-labels=eks.amazonaws.com/nodegroup=serv-test-1,eks.amazonaws.com/nodegroup-image=ami-0ebb49de26355a371' \
            --apiserver-endpoint {api-endpoint} --b64-cluster-ca {token}
    

    But still it does not work

0

Check the CloudFormation stack "eksctl-test-cluster-nodegroup-serv-test-1", click events tab to view the error message why the node group failed.

answered 2 months ago
  • It only gives this error

    Resource handler returned message: "[Issue(Code=NodeCreationFailure, Message=Instances failed to join the kubernetes cluster, ResourceIds=[i-09a3d319c13a23f59])] (Service: null, Status Code: 0, Request ID: null)" (RequestToken: 16d9967f-ddfa-714b-8fe5-a1b97b10749b, HandlerErrorCode: GeneralServiceException)
    

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions