mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +00:00
Merge pull request #40771 from apprenda/kubeadm-135-FQDN
Automatic merge from submit-queue (batch tested with PRs 40574, 40806, 40308, 40771, 39440) kubeadm: preflight check for incorrect FQDN **What this PR does / why we need it**: There are a variety of system configuration errors (such as cloud-init bugs when deploying on AWS) which can cause hostname and uname -n to be wrong for a given host. This will cause kubeadm setup to fail in interesting and hard-to-figure-out ways (it doesn't fail until you start trying to set up DNS on the master, for example). This PR adds a preflight check to test whether or not the server can reach itself using that name. This does not catch the case that the FQDN belongs to a different but valid server, but it would catch some of the cases. **Which issue this PR fixes** : fixes https://github.com/kubernetes/kubeadm/issues/135 **Special notes for your reviewer**: /cc @luxas **Release note**: ```release-note NONE ```
This commit is contained in:
commit
2ee058c2cc
@ -243,6 +243,13 @@ func (hc HostnameCheck) Check() (warnings, errors []error) {
|
||||
for _, msg := range validation.ValidateNodeName(hostname, false) {
|
||||
errors = append(errors, fmt.Errorf("hostname \"%s\" %s", hostname, msg))
|
||||
}
|
||||
addr, err := net.LookupHost(hostname)
|
||||
if addr == nil {
|
||||
errors = append(errors, fmt.Errorf("hostname \"%s\" could not be reached", hostname))
|
||||
}
|
||||
if err != nil {
|
||||
errors = append(errors, fmt.Errorf("hostname \"%s\" %s", hostname, err))
|
||||
}
|
||||
return nil, errors
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user