diff --git a/pkg/agent/config/config.go b/pkg/agent/config/config.go index 294c798967..28588f5f42 100644 --- a/pkg/agent/config/config.go +++ b/pkg/agent/config/config.go @@ -396,19 +396,3 @@ func getConfig(info *clientaccess.Info) (*config.Control, error) { controlControl := &config.Control{} return controlControl, json.Unmarshal(data, controlControl) } - -func HostnameCheck(cfg cmds.Agent) error { - hostname, _, err := getHostnameAndIP(cfg) - if err != nil { - return err - } - for i := 0; i < 5; i++ { - _, err = sysnet.LookupHost(hostname) - if err == nil { - return nil - } - logrus.Infof("Waiting for hostname %s to be resolvable: %v", hostname, err) - time.Sleep(time.Second * 3) - } - return fmt.Errorf("Timed out waiting for hostname %s to be resolvable: %v", hostname, err) -} diff --git a/pkg/agent/run.go b/pkg/agent/run.go index d6f6c6dc29..95777c7f16 100644 --- a/pkg/agent/run.go +++ b/pkg/agent/run.go @@ -25,10 +25,6 @@ import ( func run(ctx context.Context, cfg cmds.Agent, lb *loadbalancer.LoadBalancer) error { nodeConfig := config.Get(ctx, cfg) - if err := config.HostnameCheck(cfg); err != nil { - return err - } - if !nodeConfig.NoFlannel { if err := flannel.Prepare(ctx, nodeConfig); err != nil { return err diff --git a/pkg/agent/templates/templates.go b/pkg/agent/templates/templates.go index 7853c3f11f..d25c83b774 100644 --- a/pkg/agent/templates/templates.go +++ b/pkg/agent/templates/templates.go @@ -17,7 +17,7 @@ const ContainerdConfigTemplate = ` path = "{{ .NodeConfig.Containerd.Opt }}" [plugins.cri] -stream_server_address = "{{ .NodeConfig.AgentConfig.NodeName }}" +stream_server_address = "127.0.0.1" stream_server_port = "10010" {{- if .IsRunningInUserNS }} diff --git a/pkg/cli/server/server.go b/pkg/cli/server/server.go index ded7c8be4a..e0cccf7028 100644 --- a/pkg/cli/server/server.go +++ b/pkg/cli/server/server.go @@ -165,7 +165,7 @@ func run(app *cli.Context, cfg *cmds.Server) error { } ip := serverConfig.TLSConfig.BindAddress if ip == "" { - ip = "localhost" + ip = "127.0.0.1" } url := fmt.Sprintf("https://%s:%d", ip, serverConfig.TLSConfig.HTTPSPort) token := server.FormatToken(serverConfig.ControlConfig.Runtime.NodeToken, certs) diff --git a/pkg/daemons/control/server.go b/pkg/daemons/control/server.go index 280c296d61..41fa9b45e5 100644 --- a/pkg/daemons/control/server.go +++ b/pkg/daemons/control/server.go @@ -474,7 +474,7 @@ func genClientCerts(config *config.Control, runtime *config.ControlRuntime) erro factory := getSigningCertFactory(regen, nil, []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth}, runtime.ClientCA, runtime.ClientCAKey) var certGen bool - apiEndpoint := fmt.Sprintf("https://localhost:%d", config.ListenPort) + apiEndpoint := fmt.Sprintf("https://127.0.0.1:%d", config.ListenPort) certGen, err = factory("system:admin", []string{"system:masters"}, runtime.ClientAdminCert, runtime.ClientAdminKey) if err != nil { diff --git a/pkg/server/server.go b/pkg/server/server.go index 0d94adde5a..0663befc00 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -193,7 +193,7 @@ func printTokens(certs, advertiseIP string, tlsConfig *dynamiclistener.UserConfi ) if advertiseIP == "" { - advertiseIP = "localhost" + advertiseIP = "127.0.0.1" } if len(config.Runtime.NodeToken) > 0 { @@ -213,7 +213,7 @@ func writeKubeConfig(certs string, tlsConfig *dynamiclistener.UserConfig, config clientToken := FormatToken(config.ControlConfig.Runtime.ClientToken, certs) ip := tlsConfig.BindAddress if ip == "" { - ip = "localhost" + ip = "127.0.0.1" } url := fmt.Sprintf("https://%s:%d", ip, tlsConfig.HTTPSPort) kubeConfig, err := HomeKubeConfig(true, config.Rootless)