1
0
mirror of https://github.com/ubuntu/microk8s.git synced 2021-05-23 02:23:41 +03:00

Check machine hostname during inspection (#1562)

Co-authored-by: Nick Veitch <nick.veitch@canonical.com>
This commit is contained in:
Konstantinos Tsakalozos
2020-09-14 21:07:16 +03:00
committed by GitHub
parent b4b29d4f61
commit 8e1367a23b

View File

@@ -202,6 +202,17 @@ function suggest_fixes {
printf -- '\t https://microk8s.io/docs/lxd \n'
fi
fi
# node name
nodename="$(hostname)"
if [[ "$nodename" =~ [A-Z|_] ]] && ! grep -e "hostname-override" /var/snap/microk8s/current/args/kubelet &> /dev/null
then
printf -- "\033[0;33mWARNING: \033[0m This machine's hostname contains capital letters and/or underscores. \n"
printf -- "\t This is not a valid name for a Kubernetes node, causing node registration to fail.\n"
printf -- "\t Please change the machine's hostname or refer to the documentation for more details: \n"
printf -- "\t https://microk8s.io/docs/troubleshooting#heading--common-issues \n"
fi
}
function fedora_release {