From ee2418c7aaf8ecc99ac2aa4af3d2b248c9d2bf50 Mon Sep 17 00:00:00 2001 From: Lantao Liu Date: Wed, 27 Nov 2019 11:46:12 -0800 Subject: [PATCH] Move hostdns.conf out of cni directory. --- cluster/gce/util.sh | 2 +- cluster/gce/windows/k8s-node-setup.psm1 | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cluster/gce/util.sh b/cluster/gce/util.sh index e0e645bda7a..afc2b1284cf 100755 --- a/cluster/gce/util.sh +++ b/cluster/gce/util.sh @@ -878,7 +878,7 @@ function construct-windows-kubelet-flags { flags+=" --logtostderr=false" # Configure the file path for host dns configuration - flags+=" --resolv-conf=${WINDOWS_CNI_CONFIG_DIR}\hostdns.conf" + flags+=" --resolv-conf=${WINDOWS_CNI_DIR}\hostdns.conf" # Both --cgroups-per-qos and --enforce-node-allocatable should be disabled on # windows; the latter requires the former to be enabled to work. diff --git a/cluster/gce/windows/k8s-node-setup.psm1 b/cluster/gce/windows/k8s-node-setup.psm1 index c0ed6f5aec7..5396c592e1c 100644 --- a/cluster/gce/windows/k8s-node-setup.psm1 +++ b/cluster/gce/windows/k8s-node-setup.psm1 @@ -1004,7 +1004,9 @@ function Configure-HostDnsConf { $conf = $conf + "nameserver $ip`r`n" } $conf = $conf + "search $search_list" - $hostdns_conf = "${env:CNI_CONFIG_DIR}\hostdns.conf" + # Do not put hostdns.conf into the CNI config directory so as to + # avoid the container runtime treating it as CNI config. + $hostdns_conf = "${env:CNI_DIR}\hostdns.conf" New-Item -Force -ItemType file ${hostdns_conf} | Out-Null Set-Content ${hostdns_conf} $conf Log-Output "HOST dns conf:`n$(Get-Content -Raw ${hostdns_conf})"