Skip to content
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 now uses cgo for all DNS queries #3457

Closed
bcressey opened this issue Sep 14, 2023 · 0 comments · Fixed by #3455
Closed

kubelet now uses cgo for all DNS queries #3457

bcressey opened this issue Sep 14, 2023 · 0 comments · Fixed by #3455
Assignees
Labels
area/networking Issues related to networking support or configuration status/in-progress This issue is currently being worked on type/bug Something isn't working

Comments

@bcressey
Copy link
Contributor

Image I'm using:
aws-k8s-1.28

What I expected to happen:
When bootstrapping a cluster, kubelet should try multiple entries for the same host in /etc/hosts:

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.0.10.1 asdfasdfasfd.aws.dev
10.0.10.2 asdfasdfasfd.aws.dev
10.0.10.3 asdfasdfasfd.aws.dev

What actually happened:
kubelet tries to connect to the first IP repeatedly.

How to reproduce the problem:
Using GODEBUG=netdns=2 we can see that cgo rather than netgo is now used.

Sample program:

package main

import (
	"fmt"
	"net"
	"os"
)

func main() {
	addrs, err := net.LookupHost(os.Args[1])
	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Println(addrs)
	}
}

List multiple IPs for the same host:

apiclient apply <<EOF
[settings.network]
hosts = [
 ["10.0.10.1", ["asdfasdfasfd.aws.dev"]],
 ["10.0.10.2", ["asdfasdfasfd.aws.dev"]],
 ["10.0.10.3", ["asdfasdfasfd.aws.dev"]],
]
EOF

Query the host:

# GODEBUG=netdns=2 dns-test asdfasdfasfd.aws.dev
go package net: confVal.netCgo = false  netGo = false
go package net: dynamic selection of DNS resolver
go package net: hostLookupOrder(asdfasdfasfd.aws.dev) = cgo
[10.0.10.1]

This happens because netgo sees the new "resolve" directive in nsswitch.conf, and knows it cannot use that NSS plugin so it falls back to cgo.

@bcressey bcressey added type/bug Something isn't working status/in-progress This issue is currently being worked on area/networking Issues related to networking support or configuration labels Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/networking Issues related to networking support or configuration status/in-progress This issue is currently being worked on type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants