Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to deploy Kubernetes with multiple nodes

Shulou Source: shulou.com Published: 2022-06-03 05:08:18 09月21日 Update

This article is about Kubernetes multi-node deployment. The editor thought it was very practical, so I shared it with you to learn. The following information is about Kubernetes multi-node deployment.

Environment preparation role address installation component master192.168.142.129kube-apiserver kube-controller-manager kube-scheduler etcdmaster2192.168.142.120kube-apiserver kube-controller-manager kube-schedulernode1192.168.142.130kubelet kube-proxy docker flannel etcdnode2192.168.142.131kubelet kube-proxy docker flannel etcdnginx1 (lbm) 192.168.142.140nginx keepalivednginx2 (lbb) 192.168.142.150nginx keepalivedVIP192.168.142.20-

Resource Kit links:

Https://pan.baidu.com/s/183G9ZzBNdcUUFV7Y8-K4CQ extraction code: 6z0j 1. Deploy Master2

1. Remote replication of master related directories

Turn off firewall and security functions systemctl stop firewalld.servicesetenforce 0 copy kubernetes directory to master2scp-r / opt/kubernetes/ root@192.168.142.120:/opt copy etcd directory to master2 (including certificates) scp-r / opt/etcd/ root@192.168.142.120:/opt replication service startup script to master2scp / usr/lib/systemd/system/ {kube-apiserver,kube-controller-manager,kube-scheduler} .service root@192.168.142.120:/usr/lib/systemd/system/

two。 Modify kube-apiserver configuration file

Vim / opt/kubernetes/cfg/kube-apiserver# changes lines 5 and 7 IP address to the address of the master2 host-- bind-address=192.168.142.120\-- advertise-address=192.168.142.120\

3. Start the service and set to boot automatically

Systemctl start kube-apiserver.servicesystemctl enable kube-apiserver.servicesystemctl start kube-controller-manager.servicesystemctl enable kube-controller-manager.servicesystemctl start kube-scheduler.servicesystemctl enable kube-scheduler.service

4. Append environment variables and take effect

Add export PATH=$PATH:/opt/kubernetes/bin/source / etc/profile at the end of vim / etc/profile#

5. View the node node

Kubectl get nodeNAME STATUS ROLES AGE VERSION192.168.142.130 Ready 10d12h v1.12.3192.168.142.131 Ready 10d11h v1.12.3 II, Nginx load balance deployment-keeplived service

1. Operation on the lbm& LBB side to install the nginx service

Copy the nginx.sh and keepalived.conf scripts to the home directory (used later) # nginx.shcat > / etc/yum.repos.d/nginx.repo dashboard-csr.json

Tags: Address service file information directory configuration node token content instance script priority quantity method log more server browser status environment Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information MySQL MariaDB Microsoft Shulou Technology