master:
yum upgrade
yum update
ifconfig ens33
cat /sys/class/dmi/id/product_uuid
swapoff -a
vim /etc/fstab
#/dev/mapper/cl-swap swap swap defaults 0 0
vim /etc/sysctl.conf
vm.swappiness = 0
net.bridge.bridge-nf-call-arptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
lsmod |grep br_netfilter
modprobe br_netfilter
lsmod |grep br_netfilter
sysctl -p
systemctl disable firewalld.service && systemctl stop firewalld.service
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo
sudo sed -i ‘s+download.docker.com+mirrors.tuna.tsinghua.edu.cn/docker-ce+’ /etc/yum.repos.d/docker-ce.repo
yum makecache
yum install docker-ce-19.03.15
systemctl enable docker
systemctl start docker
cat < /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=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF
setenforce 0
cat /etc/selinux/config
disabled - No SELinux policy is loaded.
SELINUX=disabled
yum install kubeadm kubelet kubectl
systemctl enable kubelet.service
kubeadm init --kubernetes-version=v1.21.1 --apiserver-advertise-address 192.168.72.100 --pod-network-cidr 10.244.0.0/16
wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
docker pull quay.io/coreos/flannel:v0.14.0
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown ( i d ? u ) : (id -u): (id?u):(id -g) $HOME/.kube/config
kubectl get nodes
kubectl apply -f kube-flannel.yml
kubectl get nodes
[root@k8smaster ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8smaster Ready control-plane,master 44m v1.21.1
k8snode1 Ready 12m v1.21.1
k8snode2 Ready 11m v1.21.1
node:
kubeadm join 192.168.168.5:6443 --token vmkj30.n8udsom3uia13cfp \
--discovery-token-ca-cert-hash sha256:b8a50fb27169d6b2ff3ff24bc9c519a195c3f167bd603381f660a80b3a7f4e40
?