kubernetes: kubelet doesn't merge multiple 'options' lines from node /etc/resolv.conf

What happened?

If the content of /etc/resolv.conf is

options timeout:1 
options attempts:3

https://github.com/kubernetes/kubernetes/blob/ca09ed0fe2c245a0df4f533aa29f7b48a8672cff/pkg/kubelet/network/dns/dns.go#L250-L278

only could recognize the last option options attempts:3 and options timeout:1 is ignored. And user has to use options timeout:1 attempts:3 to workaround the issue.

But this format is valid actually and able to read correctly in golang and libc.

What did you expect to happen?

Able to parse multiple options lines in /etc/resolv.conf correctly.

How can we reproduce it (as minimally and precisely as possible)?

Use

options timeout:1 
options attempts:3

in the host’s /etc/resolv.conf file and then inside POD’s /etc/resolv.conf, it would become

options attempts:3

Anything else we need to know?

No response

Kubernetes version

Any version.

Cloud provider

N.A.

OS version

Ubuntu 22.04

Install tools

No response

Container runtime (CRI) and version (if applicable)

No response

Related plugins (CNI, CSI, …) and versions (if applicable)

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 30 (30 by maintainers)

Most upvoted comments

Previous discussion and interesting comment from @thockin #91052 (comment)

Just have the book on my desktop. 😄 image