To deploy a 3-node k8s cluster, version 1.24.2 is required.

Deploy a 3-node k8s cluster

**

Environment deployment (three virtual machines)

**
Check the version of the operating system (installing the kubernetes cluster in this way requires the Centos version to be 7.9)
insert image description here
host name resolution (download a vim first, otherwise it is not very habitual)
insert image description here
enter vim /etc/hosts
insert image description here
to modify the host name, the first one is master .The second one is node1. The third one is node2

insert image description here
Time synchronization, download chrony.

insert image description here
Modify the configuration file, comment all the previous ones, and configure the seventh line.
insert image description here
Restart the service, boot up, and then check the synchronization.

insert image description here
Then close the selinux service. setenforce 0, then check the selinux status
insert image description here
Close the firewall, then restart
insert image description here
Disable the swap partition, enter /etc/fstab, comment out the swap line to
insert image description here
upgrade the operating system kernel
Import elrepo gpg key
insert image description here
install elrepo YUM source warehouse
insert image description here
install kernel-ml version, ml is long-term stable version, lt is the long-term maintenance version.
insert image description here
Set the default boot of grub2 to 0
insert image description here
to regenerate the grub2 boot file
insert image description here
. After the update, you need to restart and use the upgraded
insert image description here
kernel to take effect
insert image description here
. Kernel parameters
Edit the /etc/sysctl.d/kubernetes.conf file
insert image description here
Reload the configuration (don’t care if the file does not exist)
insert image description here
Load the bridge filter module
insert image description here
Check whether the bridge filter module is loaded successfully
insert image description here
Configure the ipvs function
Install ipset and ipvsadm
insert image description here
to add the modules that need to be loaded Write the script file
insert image description here
Add execution permission to the script file
insert image description here
Execute the script file
insert image description here
Check whether the corresponding module is loaded successfully
insert image description here
K8s basic environment preparation
Switch the mirror source to China (the yum source of Alibaba Cloud is used here)

insert image description here
View all available editions
insert image description here

Cluster software installation (version 1.24.2)

insert image description here
Check the version after installation
insert image description here
Configure the cgroup of kubelet
insert image description here
to set kubelet to start automatically after booting
insert image description here
and then create a snapshot

Install containerd

Install some necessary system tools
insert image description here
Add software source information
insert image description here
Query software packages
insert image description here
Install software packages
insert image description here
Initialize default configuration
insert image description here
Modify containerd configuration Change cgroup
insert image description here
Modify mirror source
insert image description here
Configure crictl
insert image description here
to restart, reload, and automatically open

insert image description here
Verify that
insert image description here
the Master node can be initialized
Generate configuration files
insert image description here
Modify the following configuration:

- advertiseAddress:为控制切面地址,( Master 主机 IP )
- criSocket:为 containerd 的 socket 文件地址
- name:master
- imageRepository:阿里云镜像代理地址,否则拉取镜像会失败
- kubernetesVersion:为 k8s 版本

insert image description here

View the list of required images
insert image description here
Pull the image
insert image description here
Start kubeadm according to the configuration file Initialize k8s
insert image description here
and set the master as root

insert image description here
Set node1 node2 as a member
insert image description here
insert image description here
Check the cluster nodes
insert image description here
Install the network plug-in
insert image description here
Execute
insert image description here
Wait for a while, it will start and it will be OK
insert image description here

Guess you like

Origin blog.csdn.net/balanceone/article/details/126322392