New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kubelet ResolverConfig can't be empty in kubeletconfig file #70817

Closed
benmoss opened this Issue Nov 8, 2018 · 3 comments

Comments

Projects
None yet
4 participants
@benmoss
Member

benmoss commented Nov 8, 2018

What happened:
When moving from the deprecated kubelet --resolv-conf flag to the kubeletconfig resolverConfig parameter, the empty string value is treated differently. When passed as a command line argument, the value is recognized as not wanting to use a resolver config file. When specified in a config file, an empty string is taken as wanting to use the default value for the resolver config path.

What you expected to happen:
Passing an empty string should be respected, or else some other way needs to be made to signal "I don't want any resolve config".

How to reproduce it (as minimally and precisely as possible):
Set resolverConfig: "" in your kubeletconfig, see that it ends up as /etc/resolv.conf anyway.

Anything else we need to know?:
Relevant lines:

  • if obj.ResolverConfig == "" {
    obj.ResolverConfig = kubetypes.ResolvConfDefault
    }
  • // When the kubelet --resolv-conf flag is set to the empty string, use
    // DNS settings that override the docker default (which is to use
    // /etc/resolv.conf) and effectively disable DNS lookups. According to
    // the bind documentation, the behavior of the DNS client library when
    // "nameservers" are not specified is to "use the nameserver on the
    // local machine". A nameserver setting of localhost is equivalent to
    // this documented behavior.
    if c.ResolverConfig == "" {
    switch {
    case c.nodeIP == nil || c.nodeIP.To4() != nil:
    dnsConfig.Servers = []string{"127.0.0.1"}
    case c.nodeIP.To16() != nil:
    dnsConfig.Servers = []string{"::1"}
    }
    dnsConfig.Searches = []string{"."}
    }

/kind bug

@benmoss

This comment has been minimized.

Member

benmoss commented Nov 8, 2018

/sig node

@k8s-ci-robot k8s-ci-robot added sig/node and removed needs-sig labels Nov 8, 2018

@k8s-ci-robot k8s-ci-robot assigned wgliang and unassigned wgliang Nov 8, 2018

@liggitt

This comment has been minimized.

Member

liggitt commented Nov 9, 2018

Xref
#65679

@benmoss

This comment has been minimized.

Member

benmoss commented Nov 9, 2018

Good catch, looks like a duplicate to me. Thanks!

@benmoss benmoss closed this Nov 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment