#服务器环境 使用向日葵远程客户电脑,向日葵账号密码为:815793896/1234567 \2. 服务器共四台分别为: 10.126.13.198 Nginx 10.126.13.200应用 10.126.13.203应用 10.126.13.202应用+数据库 服务器账号密码都为:root/cico@123 其中之前文坚已经在10.126.13.200和10.126.13.203都装好了试用版的应用和部署了docker项目 | | | 规划 | | | ------------- | ----------- | ------- | ---- | | 10.126.13.198 | Nginx | | | | 10.126.13.200 | 应用 | Master1 | | | 10.126.13.202 | 应用+数据库 | Node1 | | | 10.126.13.203 | 应用 | Node2 | | | | | | | # 在Master1上安装 **修改主机名:(很重要,否正加入集群时没有名称)** * master节点: ``` hostnamectl set-hostname master1 ``` * node1节点: ``` hostnamectl set-hostname node1 ``` * node2节点: ``` hostnamectl set-hostname node2 ``` * db-nfs节点: ``` hostnamectl set-hostname node2 ``` ``` cat <> /etc/hosts 192.168.88.200 master1 192.168.88.211 node1 192.168.88.212 node2 192.168.88.213 db-nfs EOF ``` ** 关闭防火墙与 SELinux 已关闭。如 CentOS: ``` $ systemctl stop firewalld && systemctl disable firewalld $ setenforce 0 $ vi /etc/selinux/config SELINUX=disabled ``` ** 关闭swap ``` swapoff -a yes | cp /etc/fstab /etc/fstab_bak cat /etc/fstab_bak |grep -v swap > /etc/fstab sysctl -p # 使配置生效 ``` ** 在/etc/sysctl.conf中添加以下配置 ``` cat < /etc/sysctl.d/k8s.conf net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 net.ipv4.ip_forward = 1 EOF sysctl --system ``` ** 配置yum源 * 改成阿里源 ``` curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo ``` ** docker yum源 ``` cat >> /etc/yum.repos.d/docker.repo <> /etc/yum.repos.d/kubernetes.repo < /etc/sysctl.d/k8s.conf net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 net.ipv4.ip_forward = 1 EOF sysctl --system ``` ## 配置yum源 * docker yum源 ``` cat >> /etc/yum.repos.d/docker.repo <> /etc/yum.repos.d/kubernetes.repo < /etc/docker/daemon.json < metallb-configmap.yaml <