Skip to content

Conversation

guessi
Copy link
Contributor

@guessi guessi commented Oct 8, 2025

Description

Fixes #7946 by preventing duplicate --max-pods arguments in KUBELET_EXTRA_ARGS when using the deprecated MaxPodsPerNode setting with AL2 managed nodegroups.

Problem

When MaxPodsPerNode is set, eksctl's makeMaxPodsScript function appends --max-pods to KUBELET_EXTRA_ARGS without checking if it already exists, resulting in:

KUBELET_EXTRA_ARGS=... --max-pods=58 --max-pods=30

Solution

Modified makeMaxPodsScript to:

  • Remove any existing --max-pods=<number> arguments using sed
  • Clean up extra spaces
  • Append the new --max-pods value

Impact

  • AL2 managed nodegroups: Fixed duplicate --max-pods issue
  • AL2023: No impact (uses nodeadm configuration, not bootstrap scripts)
  • Backward compatibility: Maintained

Testing

The fix ensures only one --max-pods argument appears in KUBELET_EXTRA_ARGS, with eksctl's MaxPodsPerNode value taking precedence.

@guessi guessi changed the title Fix duplicate --max-pods arguments in KUBELET_EXTRA_ARGS fix: duplicate --max-pods arguments in KUBELET_EXTRA_ARGS Oct 8, 2025
@guessi guessi force-pushed the fix-duplicate-max-pods-7946 branch from f4d486c to 8e572a9 Compare October 8, 2025 07:13
set -ex
`
script += fmt.Sprintf(`sed -i 's/KUBELET_EXTRA_ARGS=$2/KUBELET_EXTRA_ARGS="$2 --max-pods=%d"/' /etc/eks/bootstrap.sh`, maxPods)
script += fmt.Sprintf(`sed -i 's/KUBELET_EXTRA_ARGS=$2/KUBELET_EXTRA_ARGS="$(echo "$2" | sed "s/--max-pods=[0-9]*//" | sed "s/ */ /g" | sed "s/^ *//" | sed "s/ *$//") --max-pods=%d"/' /etc/eks/bootstrap.sh`, maxPods)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the duplicated --max-pods the same value or one value disagreeing?

Instead of removing the max pod with sed can we avoid setting it in two places? Still wrapping my head around this issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it should be prevented from the beginning, but we don't have control for what could be passed via $2 as it could always be customized by end users. ( unlike AL2023, it's all handled by NodeConfig )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Duplicate --max-pods attribute passed to KUBELET_EXTRA_ARGS while deprecated MaxPodsPerNode set

2 participants