-
Notifications
You must be signed in to change notification settings - Fork 730
Description
What keywords did you search in kubeadm issues before filing this one?
resolvConf, resolv-conf, resolved, dns
Is this a BUG REPORT or FEATURE REQUEST?
BUG REPORT
Versions
kubeadm version (use kubeadm version
):
kubeadm version: &version.Info{Major:"1", Minor:"17+", GitVersion:"v1.17.4-2+a00aae1e6a4a69", GitCommit:"a00aae1e6a4a698595445ec86aab1502a495c1ce", GitTreeState:"clean", BuildDate:"2020-04-21T14:37:28Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}
Environment:
- Kubernetes version (use
kubectl version
):
Client Version: version.Info{Major:"1", Minor:"17+", GitVersion:"v1.17.4-2+a00aae1e6a4a69", GitCommit:"a00aae1e6a4a698595445ec86aab1502a495c1ce", GitTreeState:"clean", BuildDate:"2020-04-21T14:38:23Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"17+", GitVersion:"v1.17.4-2+a00aae1e6a4a69", GitCommit:"a00aae1e6a4a698595445ec86aab1502a495c1ce", GitTreeState:"clean", BuildDate:"2020-04-21T14:36:02Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}
- Cloud provider or hardware configuration:
n/a
- OS (e.g. from /etc/os-release):
VMware Photon OS 3.0"
- Kernel (e.g.
uname -a
):
Linux 42066f5b2159256bef8e84ca8ff4e219 4.19.112-1.ph3-esx #1-photon SMP Fri Mar 27 09:35:09 UTC 2020 x86_64 GNU/Linux
- Others:
What happened?
When systemd-resolved is enabled kubeadm
ignores the value specified in resolvConf
in favour of the systemd managed file /run/systemd/resolve/resolv.conf
.
The specific value used in this case was:
resolvConf: /run/systemd/resolve/stub-resolv.conf
This is a problem for two reasons:
- I want to use stub resolver in this instance and need a way of specifying it.
- Direct use of the
/run/systemd/resolve/resolv.conf
introduces a race betweensystemd
andkubelet
. We have observed intermittent instances of containers being created with/etc/resolv.conf
(inside the container) only containing the leading comment block but no DNS entries. Hypothesis is that kubelet is racing with systemd regenerating the file.
On an environment with DHCP configured DNS running systemctl restart systemd-networkd
in a separate shell generates the following output. It can be seen that there are multiple (7 in this case) steps in regenerating this file, and all but the last are missing the DNS servers.
root@42066f5b2159256bef8e84ca8ff4e219 [ /run/systemd/resolve ]# while inotifywait -e modify -e create -e close_write /run/systemd/resolve; do cat resolv.conf;done
Setting up watches.
Watches established.
/run/systemd/resolve/ CREATE .#resolv.confJJJx5C
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
# No DNS servers known.
Setting up watches.
Watches established.
/run/systemd/resolve/ CREATE .#resolv.confFjPqMZ
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
# No DNS servers known.
Setting up watches.
Watches established.
/run/systemd/resolve/ CREATE .#resolv.confPJxJG8
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
Setting up watches.
Watches established.
/run/systemd/resolve/ CREATE .#resolv.confTlGXGk
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
Setting up watches.
Watches established.
/run/systemd/resolve/ CREATE .#resolv.confpLAKTU
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
Setting up watches.
Watches established.
/run/systemd/resolve/ CREATE .#resolv.confvZGw3m
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
Setting up watches.
Watches established.
/run/systemd/resolve/ CREATE .#resolv.confPXyK0J
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 10.195.12.31
nameserver 10.172.40.1
Setting up watches.
Watches established.
What you expected to happen?
kubeadm
honours the explicit value when present in the config.
kubeadm
documents the race with systemd-networkd, or choses a different means of supplying DNS.
How to reproduce it (as minimally and precisely as possible)?
In a system with systemd-resolved enabled specify resolvConfig
in kubeadm.yaml
kind: KubeletConfiguration
metadata:
name: kubeadm-kubelet
resolvConf: /run/systemd/resolve/stub-resolv.conf
The generated /var/lib/kubelet/kubeadm-flags.env
file contains:
--resolv-conf=/run/systemd/resolve/resolv.conf
instead of:
--resolv-conf=/run/systemd/resolve/stub-resolv.conf
Anything else we need to know?
This behaviour was added in kubernetes/kubernetes#64665