使用vmware创建了三台2u4G的虚拟机
系统centos7.4 mini安装
关闭防火墙
systemctl disable firewalld.service
systemctl stop firewalld.service
关闭selinux
cat /etc/selinux/config |grep "^SELINUX="
SELINUX=disabled
启用时间同步
yum install chrony -y
systemctl start chronyd.service
systemctl enable chronyd.service
修改主机名
hosts文件
修改系统参数
[root@master ~]# cat /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-iptables=1
net.bridge.bridge-nf-call-ip6tables=1
关闭swap
swapoff -a
[root@master ~]# cat /etc/fstab |grep swap
#/dev/mapper/centos-swap swap swap defaults 0 0
配置yum源
cd /etc/yum.repos.d/
curl -O https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
[root@master yum.repos.d]# cat kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
安装docker
yum install docker-ce -y
因k8s需要在google中的docker库中拉取镜像 所以需要配置一下能上google的代理
/usr/lib/systemd/system/docker.service
ExecStartPost=/usr/sbin/iptables -P FORWARD ACCEPT
Environment="HTTP_PROXY=10.0.2.1:808"
Environment="NO_PROXY=127.0.0.0/8,10.0.0.0/8,192.168.0.0/16"
修改完后重启一下docker
systemctl daemon-reload
systemctl start docker.service
systemctl enable docker.service
使用yum安装k8s
yum install kubeadm-1.13.3 kubelet-1.13.3 -y