增加用户并配置sudo
$ sudo adduser username
$ sudo nano /etc/sudoers
----------------------------------
username ALL=(ALL) NOPASSWD:ALL
----------------------------------
配置静态IP
sudo nano /etc/network/interfaces.d/50-cloud-init.cfg
#配置的是50-cloud-init.cfg 而不是network下的interface
-----------------------------------
auto lo
iface lo inet loopback
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.31.52
netmask 255.255.255.0
gateway 192.168.31.1
----------------------------------
配置外网访问
$ sudo nano /etc/resolvconf/resolv.conf.d/base
#配置 的是/etc/resolvconf/resolv.conf.d/base 而不是/etc/resolv.conf
----------------------------------
nameserver 8.8.8.8
nameserver 8.8.4.4
----------------------------------
配置hostname
$ sudo nano /etc/cloud/cloud.cfg
preserve_hostname: false
修改
preserve_hostname: true
sudo hostnamectl set-hostname kmaster
#追加IP
sudo nano /etc/cloud/templates/hosts.debian.tmpl
192.168.31.50 kmaster
192.168.31.51 knode1
192.168.31.52 knode2
192.168.31.53 knode3
重启
ping: socket: Operation not permitted的解决
$ sudo chmod u+s /bin/ping