func NewJoin(cfgPath string, args []string, cfg *kubeadmapi.NodeConfiguration, skipPreFlight bool) (*Join, error) { fmt.Println("[kubeadm] WARNING: kubeadm is in alpha, please do not use it for production clusters.") if cfgPath != "" { b, err := ioutil.ReadFile(cfgPath) if err != nil { return nil, fmt.Errorf("unable to read config from %q [%v]", cfgPath, err) } if err := runtime.DecodeInto(api.Codecs.UniversalDecoder(), b, cfg); err != nil { return nil, fmt.Errorf("unable to decode config from %q [%v]", cfgPath, err) } } if !skipPreFlight { fmt.Println("[preflight] Running pre-flight checks") // First, check if we're root separately from the other preflight checks and fail fast if err := preflight.RunRootCheckOnly(); err != nil { return nil, err } // Then continue with the others... if err := preflight.RunJoinNodeChecks(cfg); err != nil { return nil, err } } else { fmt.Println("[preflight] Skipping pre-flight checks") } // Try to start the kubelet service in case it's inactive preflight.TryStartKubelet() return &Join{cfg: cfg}, nil }
func NewReset(skipPreFlight, removeNode bool) (*Reset, error) { if !skipPreFlight { fmt.Println("[preflight] Running pre-flight checks") if err := preflight.RunRootCheckOnly(); err != nil { return nil, err } } else { fmt.Println("[preflight] Skipping pre-flight checks") } return &Reset{ removeNode: removeNode, }, nil }
func NewInit(cfgPath string, cfg *kubeadmapi.MasterConfiguration, skipPreFlight bool) (*Init, error) { fmt.Println("[kubeadm] WARNING: kubeadm is in alpha, please do not use it for production clusters.") if cfgPath != "" { b, err := ioutil.ReadFile(cfgPath) if err != nil { return nil, fmt.Errorf("unable to read config from %q [%v]", cfgPath, err) } if err := runtime.DecodeInto(api.Codecs.UniversalDecoder(), b, cfg); err != nil { return nil, fmt.Errorf("unable to decode config from %q [%v]", cfgPath, err) } } // Set defaults dynamically that the API group defaulting can't (by fetching information from the internet, looking up network interfaces, etc.) err := setInitDynamicDefaults(cfg) if err != nil { return nil, err } if !skipPreFlight { fmt.Println("[preflight] Running pre-flight checks") // First, check if we're root separately from the other preflight checks and fail fast if err := preflight.RunRootCheckOnly(); err != nil { return nil, err } // Then continue with the others... if err := preflight.RunInitMasterChecks(cfg); err != nil { return nil, err } } else { fmt.Println("[preflight] Skipping pre-flight checks") } // Try to start the kubelet service in case it's inactive preflight.TryStartKubelet() return &Init{cfg: cfg}, nil }
func NewInit(cfgPath string, cfg *kubeadmapi.MasterConfiguration, skipPreFlight bool) (*Init, error) { fmt.Println("[kubeadm] WARNING: kubeadm is in alpha, please do not use it for production clusters.") if cfgPath != "" { b, err := ioutil.ReadFile(cfgPath) if err != nil { return nil, fmt.Errorf("unable to read config from %q [%v]", cfgPath, err) } if err := runtime.DecodeInto(api.Codecs.UniversalDecoder(), b, cfg); err != nil { return nil, fmt.Errorf("unable to decode config from %q [%v]", cfgPath, err) } } // Auto-detect the IP if len(cfg.API.AdvertiseAddresses) == 0 { ip, err := netutil.ChooseHostInterface() if err != nil { return nil, err } cfg.API.AdvertiseAddresses = []string{ip.String()} } if !skipPreFlight { fmt.Println("[preflight] Running pre-flight checks") // First, check if we're root separately from the other preflight checks and fail fast if err := preflight.RunRootCheckOnly(); err != nil { return nil, err } // Then continue with the others... if err := preflight.RunInitMasterChecks(cfg); err != nil { return nil, err } } else { fmt.Println("[preflight] Skipping pre-flight checks") } // Try to start the kubelet service in case it's inactive preflight.TryStartKubelet() // validate version argument ver, err := kubeadmutil.KubernetesReleaseVersion(cfg.KubernetesVersion) if err != nil { if cfg.KubernetesVersion != kubeadmapiext.DefaultKubernetesVersion { return nil, err } else { ver = kubeadmapiext.DefaultKubernetesFallbackVersion } } cfg.KubernetesVersion = ver fmt.Println("[init] Using Kubernetes version:", ver) // Warn about the limitations with the current cloudprovider solution. if cfg.CloudProvider != "" { fmt.Println("WARNING: For cloudprovider integrations to work --cloud-provider must be set for all kubelets in the cluster.") fmt.Println("\t(/etc/systemd/system/kubelet.service.d/10-kubeadm.conf should be edited for this purpose)") } return &Init{cfg: cfg}, nil }