Skip to main content

micro-k8s-使用

· One min read

背景

遇到错误his is not a valid name for a Kubernetes node, causing node registration to fail.

处理步骤

查看错误:

$ microk8s inspect
WARNING:  This machine's hostname contains capital letters and/or underscores. 
This is not a valid name for a Kubernetes node, causing node registration to fail.
Please change the machine's hostname or refer to the documentation for more details:

遇到这个错误的原因是: hostname 不合法

如何查自己的hostname ?

使用hostname 或者hostnamectl 命令

$ hostname
dai-MS-7B89
$ hostnamectl
Static hostname: dai-MS-7B89
Icon name: computer-desktop
Chassis: desktop
Machine ID: d55c62a250474c459bda9aecc21307a7
Boot ID: e97354108f364004a0775ce12cc57d98
Operating System: Ubuntu 22.04 LTS
Kernel: Linux 5.15.0-56-generic
Architecture: x86-64
Hardware Vendor: Micro-Star International Co., Ltd.
Hardware Model: MS-7B89

我现在的名字是大写还有横杠

修改成myhost

sudo hostnamectl set-hostname  myhost

相关阅读