Skip to content

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

Open
@guessi

Description

@guessi

What were you trying to accomplish?

--max-pods for KUBELET_EXTRA_ARGS should have exactly one but not two when MaxPodsPerNode is assigned.

What happened?

While deprecated MaxPodsPerNode set

# --max-pods as a CLI argument is deprecated, this is a workaround until we deprecate support for maxPodsPerNode
[[ -n "${MAX_PODS}" ]] && KUBELET_ARGS+=("--max-pods=${MAX_PODS}")

it would invoke makeMaxPodsScript with append()

if ng.OverrideBootstrapCommand != nil {
scripts = append(scripts, *ng.OverrideBootstrapCommand)
} else if ng.MaxPodsPerNode != 0 {
scripts = append(scripts, makeMaxPodsScript(ng.MaxPodsPerNode))
}

However, the original KUBELET_EXTRA_ARGS already have --max-pods flag set, after sed -i it would have two --max-pods flags assigned, which is confusing (although the actual result is okay),

func makeMaxPodsScript(maxPods int) string {
script := `#!/bin/sh
set -ex
`
script += fmt.Sprintf(`sed -i 's/KUBELET_EXTRA_ARGS=$2/KUBELET_EXTRA_ARGS="$2 --max-pods=%d"/' /etc/eks/bootstrap.sh`, maxPods)
return script
}

How to reproduce it?

Create Managed Node Group with MaxPodsPerNode set.

Logs

Actual result:

[root@ip-192-168-100-200 ~]# cat /etc/systemd/system/kubelet.service.d/30-kubelet-extra-args.conf
[Service]
Environment='KUBELET_EXTRA_ARGS=... --max-pods=58 --max-pods=30' # <------------------- having double --max-pods passed.

Anything else we need to know?

n/a

Versions

$ eksctl info
eksctl version: 0.189.0
kubectl version: v1.31.0
OS: darwin

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions