swapoff -a && sed -i '/swap/ s$^\(.*\)$#\1$g' /etc/fstab
setenforce 0 && sed -i 's/^SELINUX=.*/SELINUX=disabled/'/etc/selinux/config
yum install -y kubelet-1.18.0 kubeadm1.18.0 kubectl-1.18.0 --disableexcludes=kubernetes
systemctl enable kubelet && systemctl start kubelet
yum install -y yum-utils device-mapperpersistent-data lvm2
yum-config-manager --add-repo http://mirrors.aliyun.com/dockerce/linux/centos/docker-ce.repo
yum makecache fast
yum -y install docker-ce
systemctl start docker ---重启docker
systemctl enable docker ---设置开机启动
docker version
kubeadm config print init-defaults > kubeadm-config.yaml
kubeadm config images pull --config kubeadm-config.yaml
kubeadm init --config=kubeadm-config.yaml --upload-certs | tee kubeadm-init.log
kubeadm join 192.168.88.140:6443 --token abcdef.0123456789abcdef \ --discovery-token-ca-cert-hash sha256:b38529786d9a23ea303679035dc4ef4b456b2e44228af89c8762da8626665efc
只需要执行以下命令即可:
kubectl apply -f
--------------------------------微服务项目部署---------------------------------------------
vi /etc/exports
第三步:启动NFS服务
yum -y install nfs-utils rpcbind
systemctl stop nfs
systemctl stop rpcbind
systemctl start rpcbind & systemctl enable rpcbind
systemctl start nfs & systemctl enable nfs
第六步:部署nfs服务
kubectl create -f /root/k8s/A-nfs.yaml
第七步:验证NFS服务是否成功
kubectl get pod -l app=nfs-client-provisioner
------------------------------------------------------------------------------------------------------
第二步:部署mysql数据库
kubectl create -f /root/k8s/B-mysql.yaml
第三步:验证mysql服务是否成功
kubectl get pod
------------------------------------------------------------------------------------------------------
4.3 部署Nacos服务注册中心
第一步:部署nacos服务
kubectl create -f /root/k8s/C-nacos.yaml
第二步:验证nacos部署是否成功
kubectl get pod
----------------------------------------------------------------------------------------------------------------------------------------------------
4.4 部署Redis
第一步:部署redis服务
kubectl create -f /root/k8s/D-redis.yaml
第二步:验证redis部署是否成功
kubectl get pod
------------------------------------------------------------------------------------------------------
4.5 部署Nginx前端
第一步:修改nginx部署文件
修改root/k8s/E-nginx.yaml文件,修改后端服务网关地址信息:
image-20201213232212741
value值:请读者修改为自己规划的master节点的IP地址
第二步:部署nginx服务
kubectl create -f /root/k8s/E-nginx.yaml
第三步:验证nginx服务是否成功
kubectl get pod
----------------------------------------------------------------------------------------