loongnix修改K8S的主机名及IP地址,启动K8S
1.cat /etc/sysconfig/network-scripts/ifcfg-eth0 ,比如我这边显示的是ifconfig- 有线链接1
//这个修改IP地址,比如10.120.1.20
2.cat /etc/hosts
这里显示及修改主机名字为master001的设备的地址为10.120.1.20
3.cat /etc/hostname
这里显示及修改主机名字,比如master001
重点:必须主机名字和IP地址都一一对应起来,同时必须一样。
如下,参考:
[root@centos7 ~]$ hostnamectl set-hostname centos77.magedu.com # 使用这个命令会立即生效且重启也生效 [root@centos7 ~]$ hostname # 查看下 centos77.magedu.com [root@centos7 ~]$ vim /etc/hosts # 编辑下hosts文件, 给127.0.0.1添加hostname [root@centos7 ~]$ cat /etc/hosts # 检查 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 centos77.magedu.com ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
4.启动K8S
systemctl restart network
systemctl start docker
然后kubectl get pods -A

浙公网安备 33010602011771号