terraform-aws-modules / terraform-aws-eks

Terraform module to create Amazon Elastic Kubernetes (EKS) resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/eks/aws
Apache License 2.0
4.44k stars 4.06k forks source link

I can't create eks_managed_node_groups with bootstrap_extra_args #1770

Closed almukh75 closed 2 years ago

almukh75 commented 2 years ago

Description

I can't create eks_managed_node_groups as described in README.md Combination of this parameters

      bootstrap_extra_args = "--container-runtime containerd --kubelet-extra-args '--max-pods=20'"
      pre_bootstrap_user_data = <<-EOT
        export CONTAINER_RUNTIME="containerd"
        export USE_MAX_PODS=false
      EOT

doesn't work with or without below parameters

     create_launch_template = true
      launch_template_name  = "sample"

if I use enable_bootstrap_user_data = true I get error

╷
│ Error: error waiting for EKS Node Group (stage-my:sample-20220112071148935700000013) to create: unexpected state 'CREATE_FAILED', wanted target 'ACTIVE'. last error: 1 error occurred:
│   * : Ec2LaunchTemplateInvalidConfiguration: User data was not in the MIME multipart format.
│ 
│ 
│ 
│   with module.eks.module.eks_managed_node_group["infra"].aws_eks_node_group.this[0],
│   on .terraform/modules/eks/modules/eks-managed-node-group/main.tf line 260, in resource "aws_eks_node_group" "this":
│  260: resource "aws_eks_node_group" "this" {

If enable_bootstrap_user_data = false I have such user data in launch template

MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="//"

--//
Content-Transfer-Encoding: 7bit
Content-Type: text/x-shellscript
Mime-Version: 1.0

export CONTAINER_RUNTIME="containerd"
export USE_MAX_PODS=false

--//
Content-Type: text/x-shellscript; charset="us-ascii"
#!/bin/bash
set -ex
B64_CLUSTER_CA=blabalalalala
API_SERVER_URL=https://xxxxxxx.eks.amazonaws.com
K8S_CLUSTER_DNS_IP=10.100.0.10
/etc/eks/bootstrap.sh stage-inanomo --kubelet-extra-args '--node-labels=eks.amazonaws.com/sourceLaunchTemplateVersion=2,eks.amazonaws.com/nodegroup-image=ami-02b3f04ab50ffd9f1,eks.amazonaws.com/capacityType=ON_DEMAND,eks.amazonaws.com/nodegroup=1-21-sample-20220112121826474500000002,eks.amazonaws.com/sourceLaunchTemplateId=lt-05c43969a05653768' --b64-cluster-ca $B64_CLUSTER_CA --apiserver-endpoint $API_SERVER_URL --dns-cluster-ip $K8S_CLUSTER_DNS_IP

Versions

Reproduction

Steps to reproduce the behavior: create such group using terraform-aws-eks v18.0.6

  eks_managed_node_groups = {
    extend_config = {
      # This is supplied to the AWS EKS Optimized AMI
      # bootstrap script https://github.com/awslabs/amazon-eks-ami/blob/master/files/bootstrap.sh
      bootstrap_extra_args = "--container-runtime containerd --kubelet-extra-args '--max-pods=20'"

      # This user data will be injected prior to the user data provided by the
      # AWS EKS Managed Node Group service (contains the actually bootstrap configuration)
      pre_bootstrap_user_data = <<-EOT
        export CONTAINER_RUNTIME="containerd"
        export USE_MAX_PODS=false
      EOT
    }
}

Expected behavior

I need the kubernetes node with CONTAINER-RUNTIME containerd and --kubelet-extra-args '--max-pods=20'

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.