Centos Linux 7
kubernetes 1.23.5
kuboard 3
kubernetes集群部署
192.168.131.55 master 192.168.131.56 node1 192.168.131.57 node2 192.168.131.58 node3
关闭防火墙 SELINUX swap
[root@localhost ~]# systemctl stop firewalld [root@localhost ~]# systemctl disable firewalld [root@localhost ~]# setenforce 0 [root@localhost ~]# sed -i '/^SELINUX=/c SELINUX=disabled/' /etc/selinux/config [root@localhost ~]# swapoff -a 临时关闭 [root@localhost ~]# sed -i 's/.*swap.*/#&/' /etc/fstab 永久关闭 注意: 关闭所有服务器的交换分区 所有节点操作
域名解析
[root@master ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.131.55 master 192.168.131.56 node1 192.168.131.57 node2 192.168.131.58 node3 注意: 所有节点操作
时间同步
[root@master ~]# yum install chrony -y [root@master ~]# systemctl start chronyd [root@master ~]# systemctl enable chronyd [root@master ~]# sed -i 's/.*swap.*/#&/' /etc/fstab [root@master ~]# swapoff -a 注意: 所有节点操作
加载内核模块
[root@master ~]# modprobe br_netfilter 注意: 所有节点操作
修改内核参数
[root@master ~]# cat >> /etc/sysctl.conf <<eof net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 vm.swappiness=0 net.ipv4.ip_forward=1 eof [root@master ~]# sysctl -p net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 vm.swappiness = 0 net.ipv4.ip_forward = 1 注意: 所有节点操作
Docker
[root@master ~]# wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo --2024-07-26 02:24:25-- https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 123.125.216.228, 123.125.216.227, 123.125.216.219, ... Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|123.125.216.228|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 2081 (2.0K) [application/octet-stream] Saving to: ‘docker-ce.repo’ docker-ce.repo 100%[================================================>] 2.03K --.-KB/s in 0.03s 2024-07-26 02:24:26 (64.1 KB/s) - ‘docker-ce.repo’ saved [2081/2081] [root@master ~]# ls anaconda-ks.cfg docker-ce.repo [root@master ~]# mv docker-ce.repo /etc/yum.repos.d/ [root@master ~]# yum install docker-ce -y [root@master ~]# systemctl start docker [root@master ~]# systemctl enable docker 注意: 所有节点操作
安装 kubeadm kubelet kubectl ipvsadm
[root@master ~]# cat >> /etc/yum.repos.d/kubernetes.repo <<eof [kubernetes] name=Kubernetes baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64 enabled=1 gpgcheck=0 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 [root@master ~]# yum -y install kubeadm-1.23.5 kubelet-1.23.5 kubectl-1.23.5 ipvsadm 注意: 所有节点操作 这里安装的是最新版本(也可以指定版本号:kubeadm-1.23.5)