in aks-node-controller/helpers/utils.go [187:230]
func ValidateAndSetLinuxKubeletFlags(kubeletFlags map[string]string, cs *datamodel.ContainerService, profile *datamodel.AgentPoolProfile) {
// If using kubelet config file, disable DynamicKubeletConfig feature gate and remove dynamic-config-dir
// we should only allow users to configure from API (20201101 and later)
delete(kubeletFlags, "--dynamic-config-dir")
delete(kubeletFlags, "--non-masquerade-cidr")
if profile != nil && profile.KubernetesConfig != nil && profile.KubernetesConfig.ContainerRuntime == "containerd" {
dockerShimFlags := []string{
"--cni-bin-dir",
"--cni-cache-dir",
"--cni-conf-dir",
"--docker-endpoint",
"--image-pull-progress-deadline",
"--network-plugin",
"--network-plugin-mtu",
}
for _, flag := range dockerShimFlags {
delete(kubeletFlags, flag)
}
}
if isKubeletServingCertificateRotationEnabled(kubeletFlags) {
// ensure the required feature gate is set
kubeletFlags["--feature-gates"] = addFeatureGateString(kubeletFlags["--feature-gates"], "RotateKubeletServerCertificate", true)
}
if IsKubernetesVersionGe(cs.Properties.OrchestratorProfile.OrchestratorVersion, "1.24.0") {
kubeletFlags["--feature-gates"] = removeFeatureGateString(kubeletFlags["--feature-gates"], "DynamicKubeletConfig")
} else if IsKubernetesVersionGe(cs.Properties.OrchestratorProfile.OrchestratorVersion, "1.11.0") {
kubeletFlags["--feature-gates"] = addFeatureGateString(kubeletFlags["--feature-gates"], "DynamicKubeletConfig", false)
}
/* ContainerInsights depends on GPU accelerator Usage metrics from Kubelet cAdvisor endpoint but
deprecation of this feature moved to beta which breaks the ContainerInsights customers with K8s
version 1.20 or higher */
/* Until Container Insights move to new API adding this feature gate to get the GPU metrics
continue to work */
/* Reference -
https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/1867-disable-accelerator-usage-metrics */
if IsKubernetesVersionGe(cs.Properties.OrchestratorProfile.OrchestratorVersion, "1.20.0") &&
!IsKubernetesVersionGe(cs.Properties.OrchestratorProfile.OrchestratorVersion, "1.25.0") {
kubeletFlags["--feature-gates"] = addFeatureGateString(kubeletFlags["--feature-gates"], "DisableAcceleratorUsageMetrics", false)
}
}