环境准备
为了演示简单,准备两台4GB内存,20GB硬盘的虚拟机,操作系统为ubuntu18.04-server
角色 | IP | HostName |
---|---|---|
Master | 192.168.47.144 | master-k8s |
Node | 192.168.47.145 | node1-k8s |
前置准备
前置准备部分在master和node1都要分别执行:
- 换源
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo vim /etc/apt/sources.list
# 阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
sudo apt update && sudo apt upgrade
- 配置静态IP
设置root用户密码,并使用root用户登录
sudo passwd root
su root
分别配置master和node1的静态ip:
vim /etc/netplan/00-installer-config.yaml
# master-k8s
network:
ethernets:
ens33:
addresses: [192.168.47.144/24]
dhcp4: false
gateway4: 192.168.47.2
nameservers:
addresses: [192.168.47.2]
optional: true
version: 2
# node1-k8s
network:
ethernets:
ens33:
addresses: [192.168.47.145/24]
dhcp4: false
gateway4: 192.168.47.2
nameservers:
addresses: [192.168.47.2]
optional: