四、集群安装实例:
1.基础服务:(请在所有节点执行)
? 关闭防火墙
[[email protected] ~]# systemctl stop firewalld.service
[[email protected] ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
? 关闭selinux
sed -i s‘/enforcing/disabled/‘ /etc/selinux/config
? 添加hosts
[[email protected] ~]# echo “10.10.14.53 k8s-master
10.10.14.55 k8s-node1
10.10.14.57 k8s-node2” >> /etc/hosts
? yum 安装docker-ce
注:需先添加docker-ce.repo到/etc/yum.repos.d(见附件)
##查看docker-ce历史版本
yum list docker-ce --showduplicates
##选择需要的docker版本
yum install docker-ce-18.06.1.ce-3.el7 -y
注:kubernetes 1.12暂不支持docker-ce 18.06以上的版本
##添加开机启动并启动服务
[[email protected] yum.repos.d]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[[email protected] yum.repos.d]# systemctl start docker
[[email protected] yum.repos.d]# docker -v
Docker version 18.06.1-ce, build e68fc7a
? 开启IPV4路由转发
[[email protected] yum.repos.d]# echo "net.ipv4.ip_forward = 1">>/etc/sysctl.conf
[[email protected] yum.repos.d]# sysctl -p
? Yum安装kubernetes相关管理工具
注:需先添加kubernetes.repo到/etc/yum.repos.d(见附件)
##查看各插件历史版本
[[email protected] yum.repos.d]# yum list kubelet --showduplicates
##选择需要的版本
[[email protected] yum.repos.d]# yum install -y kubelet-1.12.3-0 kubeadm-1.12.3-0 kubectl-1.12.3-0 --disableexcludes=kubernetes
##添加开机自启动
[[email protected] yum.repos.d]# systemctl enable kubelet && systemctl start kubelet
Created symlink from /etc/systemd/system/multi-user.target.wants/kubelet.service to /etc/systemd/system/kubelet.service.
2. 初始化master节点:
原文地址:https://www.cnblogs.com/wugengjia/p/10277288.html