目录
1.安装docker(并设置开机自启)2.安装kubeadm、kubelet核kubectl
3.回到master节点检查node节点是否接入成功,节点和组件状态是否正常
引言:
K8S的搭建方式有很多种,adm搭建是非常方便,快速的一种。
一.部署规划
master :192.168.29.55
node1:192.168.29.11
node2:192.168.29.66
二.部署环境(以下操作需要每一台设备都进行相应的修改)
1.关闭防火墙等安全策略
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# setenforce 0
[root@localhost ~]#
2.修改主机名
[root@localhost ~]# hostnamectl set-hostname master
[root@localhost ~]# su
[root@master ~]#
3.映射
[root@master ~]# vim /etc/hosts
192.168.29.55 master
192.168.29.11 node1
192.168.29.66 node2
三.部署(每一台设备都进行相同操作)
1.安装docker(并设置开机自启)
2.安装kubeadm、kubelet核kubectl
cat > /etc/yum.repos.d/kubernetes.repo << EOF
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF
3.指定版本
yum install -y kubelet-1.15.0 kubeadm-1.15.0 kubectl-1.15.0
#查看版本
rpm -qa | grep kube
#设置开机自启动
systemctl enable kubelet
4.关闭swap分区
swapoff -a
sed -i 's/.*swap.*/#&/' /etc/fstab
cat <<EOF > /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system