amazon-linux-2023 icon indicating copy to clipboard operation
amazon-linux-2023 copied to clipboard

[Bug] - Title cluster-dns cannot be set

Open tirelibirefe opened this issue 9 months ago • 1 comments

Regarding to the documentation setting clusterdns is so straightforward but it cannot be set as documented.

I use AL2023_x86_64_STANDARD EKS managed_node_group

  post_bootstrap_user_data = <<-EOT
  MIME-Version: 1.0
  Content-Type: multipart/mixed; boundary="BOUNDARY"

  --BOUNDARY
  Content-Type: text/x-shellscript; charset="us-ascii"

  #!/bin/bash
  set -o errexit
  set -o pipefail
  set -o nounset

  # Install additional packages
  yum install -y htop jq iptables-services curl wget

  # Pre-cache commonly used container images
  nohup docker pull public.ecr.aws/eks-distro/kubernetes/pause:3.2 &
  
  --BOUNDARY
  Content-Type: application/node.eks.aws

  apiVersion: node.eks.aws/v1alpha1
  kind: NodeConfig
  spec:
    kubelet:
      config:
        clusterDNS:
        - 169.254.20.10
 
  --BOUNDARY--
  EOT

sh-5.2$ sudo journalctl -u kubelet | grep "cluster-dns" Apr 11 13:33:48 ip-10-0-0-50.eu-central-1.compute.internal kubelet[1620]: I0411 13:33:48.166036 1620 flags.go:64] FLAG: --cluster-dns="[]"

tirelibirefe avatar Apr 11 '25 14:04 tirelibirefe

Hey @tirelibirefe, you should be able to see this change in the resolved kubelet configuration retrieved from kubectl get --raw "/api/v1/nodes/<nodename>/proxy/configz".

Most configurations set in the NodeConfig are written to a config file rather than passed as flags. If you're using 1.29 +, you can find this in /etc/kubernetes/kubelet/config.json.d/00-nodeadm.conf. Otherwise, they will be merged with some default configurations and stored in /etc/kubernetes/kubelet/config.json. The flag for cluster-dns is deprecated and not used by nodeadm, which is why it's seen as the default empty string slice here (ref).

Here's where that config is constructed if you are curious to see more specific details: https://github.com/awslabs/amazon-eks-ami/blob/579f25a16358252fc3a9139e50b8f2ed212b472e/nodeadm/internal/kubelet/config.go#L347

mselim00 avatar Jun 04 '25 21:06 mselim00