当前位置:网站首页>Kubernetes cluster deployment (v1.23.5)
Kubernetes cluster deployment (v1.23.5)
2022-06-26 09:22:00 【cuibin1991】
1. Deployment Topology
1.1 Service configuration and topology
Mirror image :CentOS-7-x86_64-Minimal-1908
CPU:2 nucleus
Memory :2G

1.2 Change host name
// stay master Virtual machine , Set up master01 node
hostnamectl set-hostname master01
// Take effect immediately
bash
// see /etc/hostname by master01
cat /etc/hostname
// It will take effect permanently after restart
reboot
// In the same way node1 Virtual machine , Set up node01 node
hostnamectl set-hostname node01
// Take effect immediately
bash
// see /etc/hostname by node01
cat /etc/hostname
// It will take effect permanently after restart
reboot
node2 Such as node1 operation
2. install docker
// install yum Tools
yum install -y yum-utils
// Uninstall old version Docker
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
// Installation warehouse
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
// Update configuration yum After source , Generate the cache with the following command , Improve the speed of searching and installing software
sudo yum makecache fast
// install Docker
sudo yum install docker-ce docker-ce-cli containerd.io -y
// start-up docker
sudo systemctl start docker
// Set boot up
sudo systemctl enable docker
sudo systemctl status docker
// New configuration file
cat >> /etc/docker/daemon.json << EOF
{
"exec-opts":["native.cgroupdriver=systemd"]
}
EOF
// restart docker
systemctl restart docker
systemctl status docker
3. Server configuration
3.1 Turn off firewall
systemctl stop firewalld
systemctl disable firewalld
3.2 take SELinux Set to permissive Pattern ( It's equivalent to disabling )
setenforce 0
sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
3.3 allow iptables Check bridge flow
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
br_netfilter
EOF
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system
3.4 Shut down the system Swap
swapoff -a
// close swap Partition
sed -ri 's/.*swap.*/#&/' /etc/fstab
3.5 To configure /etc/hosts
// Customize master And node IP, Please modify... According to your personal situation
cat >> /etc/hosts << EOF
192.168.186.155 master01
192.168.186.156 node01
192.168.186.157 node02
EOF
4. install kubelet、kubeadm and kubectl
4.1 Configure software source
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=0
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF
// For modification repo_gpgcheck=0
4.2 install kubelet kubeadm kubectl
Install on all nodes kubelet、kubeadm and kubectl.
- kubelet Running on the Cluster On all nodes , Responsible for starting Pod And the container .
- kubeadm For initialization Cluster.
- adopt kubectl Can be deployed and managed application , View resources , establish 、 Delete and update various components .
sudo yum update -y
//sudo yum install -y kubelet-1.19.4 kubeadm-1.19.4 kubectl-1.19.4
// According to github The release , Appoint
// Abreast of the times 1.24 Version is deprecated docker, Therefore, you need to specify 1.23
sudo yum install -y kubelet-1.23.5 kubeadm-1.23.5 kubectl-1.23.5
// Default latest version
//sudo yum install -y kubelet kubeadm kubectl
sudo systemctl enable --now kubelet
sudo systemctl start kubelet
//sudo systemctl status kubelet here kubelet Not ready yet , stay kubeadm init after master Nodes will ok, take node node join After adding kubelet It will be normal
4.3 Check tool installation
yum list installed | grep kubelet
yum list installed | grep kubeadm
yum list installed | grep kubectl
// View the cluster version results Kubernetes v1.23.5
kubelet --version
![]()
5. use kubeadm establish Cluster
5.1 initialization Master
- --apiserver-advertise-address Indicate the use Master Which one? interface And Cluster Other node communications for . If Master There are many. interface, It is suggested to specify clearly , If you don't specify ,kubeadm Will automatically select the interface.
- --pod-network-cidr Appoint Pod Scope of the network .Kubernetes Support multiple network solutions , And different network solutions --pod-network-cidr Have their own requirements , I'm going to set it to 10.244.0.0/16 Because we will use flannel Network plan , Must be set to this CIDR. In the later practice, we will switch to other network solutions , such as Canal.
//apiserver-advertise-address 192.168.186.155 by master node IP, According to the individual master IP modify
kubeadm init --apiserver-advertise-address 192.168.186.155 --image-repository registry.aliyuncs.com/google_containers --pod-network-cidr 10.244.0.0/16 --service-cidr 10.96.0.0/12
Add :Kubeadm Initialization error :[ERROR CRI]: container runtime is not running
terms of settlement :
rm -rf /etc/containerd/config.toml
systemctl restart containerd
// If execution fails , Reset required
kubeadm reset
// Configure client kubectl
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
5.2 initialization worker
//worker Nodes are added to the cluster ---> stay worker node node1 On the implementation
// Can pass kubeadm token list see token
// You can also obtain commands at one time through the following commands
kubeadm token create --print-join-command
![]()
5.3 add to pod The Internet calico --> master Node execution
wget https://docs.projectcalico.org/v3.20/manifests/calico.yaml --no-check-certificate
kubectl apply -f calico.yaml
// After application here node State by NotReady --> Ready
5.4 Control surface view cluster
kubectl get nodes

kubectl get pod -A

5.5 The workload worker node node1 View cluster
// stay master01 Transfer documents to node01, among 172.168.186.156 by master01 node
scp -r /etc/kubernetes/admin.conf [email protected]:/etc/kubernetes/
// stay node1 On the implementation
echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile
source ~/.bash_profile
边栏推荐
- Phpcms applet plug-in version 4.0 was officially launched
- 编辑类型信息
- Which software is safer to open an account on
- How to solve the sample imbalance problem in machine learning?
- "One week's work on Analog Electronics" - Basic amplification circuit
- Edit type information
- The most complete and simple nanny tutorial: deep learning environment configuration anaconda+pychart+cuda+cudnn+tensorflow+pytorch
- JSON file to XML file
- Application of hidden list menu and window transformation in selenium
- 教程1:Hello Behaviac
猜你喜欢

Self learning neural network series - 8 feedforward neural networks

计算领域高质量科技期刊分级目录

What is optimistic lock and what is pessimistic lock

《一周搞定模电》-光耦等元器件

Phpcms V9 background article list adds one click push to Baidu function

Notes on setting qccheckbox style

报错ImportError: numpy.core.multiarray failed to import

"One week's work on Analog Electronics" - power amplifier

简析ROS计算图级

全面解读!Golang中泛型的使用
随机推荐
Nacos registry structure and the principle of massive service registration and concurrent read-write source code analysis
0 basic how to make a cool leadership cockpit?
Differences between commonjs and ES6 modularity
Phpcms mobile station module implements custom pseudo static settings
php提取txt文本存储json数据中的域名
51 single chip microcomputer ROM and ram
Applet realizes picture preloading (picture delayed loading)
How to handle the small program tabbar that does not support parameter transfer
【Open5GS】Open5GS安装配置
Lagrange multiplier method
"One week's solution to analog electricity" - power circuit
Srv6---is-is extension
Unity connects to Turing robot
Course paper: Copula modeling code of portfolio risk VaR
Bug encountered in training detectron2: the test set cannot be evaluated during training
kubernetes集群部署(v1.23.5)
Solutions for safety management and control at the operation site
Modify coco evaluation index maxdets=[10,15,20]
Construction practice of bank intelligent analysis and decision-making platform
Yolov5 results Txt visualization