You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

AWS EKS托管节点组自定义AMI支持:无法通过包含bootstrap.sh的YAML配置文件创建节点组

Fixing "mapping values are not allowed in this context" Error for EKS Managed Node Group with Custom AMI

Let's break down the issue and fix it step by step:

Root Cause

The error you're seeing is a YAML syntax parsing failure at line 15. This typically happens when YAML misinterprets part of your content as a key-value mapping when it shouldn't. In your case, the problem stems from the double quotes wrapping the --kubelet-extra-args parameter in the overrideBootstrapCommand block. The parameter string contains multiple colons that YAML tries to treat as mapping separators, triggering the parsing error.

Also, double-check that you're using spaces for indentation (not tabs) in your YAML file—tabs are invalid in YAML and often cause unexpected parsing issues.

Solution

Modify the overrideBootstrapCommand to use single quotes for the --kubelet-extra-args parameter instead of double quotes. This avoids YAML parsing conflicts while still working correctly in bash. Here's the corrected YAML file:

apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
  name: ginny
  region: us-west-2
  version: '1.17'
managedNodeGroups:
- name: ginny-mng-custom-ami
  instanceType: t3.small
  desiredCapacity: 2
  labels: {role: worker}
  ami: ami-0030109261aa0205b
  ssh:
    publicKeyName: bastion
  preBootstrapCommands:
  - kubelet --version > /etc/eks/test-preBootstrapCommands
  overrideBootstrapCommand: |
    #!/bin/bash
    set -ex
    /etc/eks/bootstrap.sh ginny --kubelet-extra-args '--node-labels=alpha.eksctl.io/cluster-name=ginny,alpha.eksctl.io/nodegroup-name=ginny-mng-custom-ami,eks.amazonaws.com/nodegroup=ginny-mng-custom-ami,eks.amazonaws.com/nodegroup-image=ami-0030109261aa0205b'

Verification Steps

  1. Save the corrected YAML file (note: you had a typo in the filename maanged-nodegroup.yaml—make sure it's managed-nodegroup.yaml when running the command).
  2. Re-run your eksctl command:
    eksctl create nodegroup --config-file managed-nodegroup.yaml
    
  3. Check the node group creation progress with:
    eksctl get nodegroups --cluster ginny
    

This change ensures YAML parses the bootstrap command correctly, and the single quotes will be handled properly by bash when executing the bootstrap script.

内容的提问来源于stack exchange,提问作者Gowmi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.29 19:42:42