mirror of https://github.com/k3s-io/k3s
Remove hostname requirement in `/etc/hosts`
parent
ffe0288b68
commit
a76ca2e887
|
@ -396,19 +396,3 @@ func getConfig(info *clientaccess.Info) (*config.Control, error) {
|
||||||
controlControl := &config.Control{}
|
controlControl := &config.Control{}
|
||||||
return controlControl, json.Unmarshal(data, controlControl)
|
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)
|
|
||||||
}
|
|
||||||
|
|
|
@ -25,10 +25,6 @@ import (
|
||||||
func run(ctx context.Context, cfg cmds.Agent, lb *loadbalancer.LoadBalancer) error {
|
func run(ctx context.Context, cfg cmds.Agent, lb *loadbalancer.LoadBalancer) error {
|
||||||
nodeConfig := config.Get(ctx, cfg)
|
nodeConfig := config.Get(ctx, cfg)
|
||||||
|
|
||||||
if err := config.HostnameCheck(cfg); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if !nodeConfig.NoFlannel {
|
if !nodeConfig.NoFlannel {
|
||||||
if err := flannel.Prepare(ctx, nodeConfig); err != nil {
|
if err := flannel.Prepare(ctx, nodeConfig); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -17,7 +17,7 @@ const ContainerdConfigTemplate = `
|
||||||
path = "{{ .NodeConfig.Containerd.Opt }}"
|
path = "{{ .NodeConfig.Containerd.Opt }}"
|
||||||
|
|
||||||
[plugins.cri]
|
[plugins.cri]
|
||||||
stream_server_address = "{{ .NodeConfig.AgentConfig.NodeName }}"
|
stream_server_address = "127.0.0.1"
|
||||||
stream_server_port = "10010"
|
stream_server_port = "10010"
|
||||||
|
|
||||||
{{- if .IsRunningInUserNS }}
|
{{- if .IsRunningInUserNS }}
|
||||||
|
|
Loading…
Reference in New Issue