Docker安装请看往期
1.容器云平台的初始化
master
节点主机名设置为
master
、
node
节点主机名设置为
node
,所有节点
root
密码设置为
000000,
所有 节点关闭 swap
,并配置
hosts
映射。
在 master 节点:
[root@localhost ~]# hostnamectl set-hostname master
在 node 节点:
[root@localhost ~]# hostnamectl set-hostname node
设置root密码:
echo "root:000000" | chpasswd
关闭swap:
[root@master ~]# swapoff -a
[root@master ~]# sed -i '/swap/d' /etc/fstab
[root@master ~]# free -m
total used free shared buff/cache available
Mem: 1837 339 251 8 1247 1320
Swap: 0 0 0
在所有节点,编辑 /etc/hosts
文件:
[root@master ~]# vi /etc/hosts
添加以下内容:
192.168.10.23 master
192.168.10.33 node
ping测试:
[root@node ~]# ping master
PING master (192.168.10.23) 56(84) bytes of data.
64 bytes from master (192.168.10.23): icmp_seq=1 ttl=64 time=1.02 ms
64 bytes from master (192.168.10.23): icmp_seq=2 ttl=64 time=0.464 ms
64 bytes from master (192.168.10.23): icmp_seq=3 ttl=64 time=0.603 ms
64 bytes from master (192.168.10.23): icmp_seq=4 ttl=64 time=0.510 ms
[root@master ~]# ping node
PING node (192.168.10.33) 56(84) bytes of data.
64 bytes from node (192.168.10.33): icmp_seq=1 ttl=64 time=0.459 ms
64 bytes from node (192.168.10.33): icmp_seq=2 ttl=64 time=0.400 ms
64 bytes from node (192.168.10.33): icmp_seq=3 ttl=64 time=0.372 ms
64 bytes from node (192.168.10.33): icmp_seq=4 ttl=64 time=0.440 ms
2.镜像文件的复制
如果没有镜像执行下面操作
使用 wget
下载
安装wget
sudo yum install wget -y
下载镜像
以 CentOS 7 ISO 镜像为例:
wget http://mirror.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-2009.iso
上述命令会下载 CentOS 7 ISO 镜像到当前目录。
下载k8s
wget http://example.com/path/to/kubernetes_V1.2.iso