执行 "kubeadm alpha certs xxx " 时主机名无效

hostname invalid when executing "kubeadm alpha certs xxx "

当我尝试检查我的 k8s 证书到期状态时,我 运行 使用以下命令:

kubeadm alpha certs check-expiration

最后是:

name: Invalid value: "alpha_53_116": a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')

我想知道为什么它需要检查节点的主机名?由于我的master节点的主机名无法更改,请问有什么办法可以解决这个问题吗?


补充:

OS:Centos 7.4
kubeadm 版本:1.15.0

正如您在问题中指出的,问题出在您的节点名称上。 根据documentation命令kubeadm alpha certs

The command shows expiration/residual time for the client certificates in the /etc/kubernetes/pki folder and for the client certificate embedded in the KUBECONFIG files used by kubeadm (admin.conf, controller-manager.conf and scheduler.conf).

可以在 /etc/kubernetes 中找到提到的文件。您还可以使用 kubeadm config print init-defaults 检查 kubeadm init 配置。

这些文件将包含在 kubeadm/kubernetes 中无效的主机名。 简而言之,由于 kubeadm alpha certs 是基于 KUBECONFIG 文件和 pki 文件夹,因此由于“_”符号,它不会进行验证。 不幸的是,这是语法问题,因此没有解决方法。

请记住 alpha 是 Kubeadm 实验性 sub-commands。所以以后可能会改。