|
|
@ -20,6 +20,7 @@ import (
|
|
|
|
"time"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/k3s-io/k3s/pkg/agent/proxy"
|
|
|
|
"github.com/k3s-io/k3s/pkg/agent/proxy"
|
|
|
|
|
|
|
|
agentutil "github.com/k3s-io/k3s/pkg/agent/util"
|
|
|
|
"github.com/k3s-io/k3s/pkg/cli/cmds"
|
|
|
|
"github.com/k3s-io/k3s/pkg/cli/cmds"
|
|
|
|
"github.com/k3s-io/k3s/pkg/clientaccess"
|
|
|
|
"github.com/k3s-io/k3s/pkg/clientaccess"
|
|
|
|
"github.com/k3s-io/k3s/pkg/containerd"
|
|
|
|
"github.com/k3s-io/k3s/pkg/containerd"
|
|
|
@ -306,12 +307,13 @@ func locateOrGenerateResolvConf(envInfo *cmds.Agent) string {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tmpConf := filepath.Join(os.TempDir(), version.Program+"-resolv.conf")
|
|
|
|
resolvConf := filepath.Join(envInfo.DataDir, "agent", "etc", "resolv.conf")
|
|
|
|
if err := ioutil.WriteFile(tmpConf, []byte("nameserver 8.8.8.8\n"), 0444); err != nil {
|
|
|
|
if err := agentutil.WriteFile(resolvConf, "nameserver 8.8.8.8\n"); err != nil {
|
|
|
|
logrus.Errorf("Failed to write %s: %v", tmpConf, err)
|
|
|
|
logrus.Errorf("Failed to write %s: %v", resolvConf, err)
|
|
|
|
return ""
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return tmpConf
|
|
|
|
logrus.Warnf("Host resolv.conf includes loopback or multicast nameservers - kubelet will use autogenerated resolv.conf with nameserver 8.8.8.8")
|
|
|
|
|
|
|
|
return resolvConf
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func get(ctx context.Context, envInfo *cmds.Agent, proxy proxy.Proxy) (*config.Node, error) {
|
|
|
|
func get(ctx context.Context, envInfo *cmds.Agent, proxy proxy.Proxy) (*config.Node, error) {
|
|
|
|