一、系统环境初始化
1.1 系统环境
系统: Rocky linux 8.7x64 cat /etc/hosts ---- 172.16.10.81 flyfish81 172.16.10.82 flyfish82 172.16.10.83 flyfish83 172.16.10.84 flyfish84 172.16.10.85 flyfish85 ----- 本次部署为前三台Rocky linux8.6x64 flyfish81 做 为 master 部署 flyfish82 、flyfish83 作为worker 节点
1.2 下载工具准备
1.下载kubernetes1.27.+的二进制包 github二进制包下载地址:https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.27.md wget https://dl.k8s.io/v1.27.1/kubernetes-server-linux-amd64.tar.gz 2.下载etcdctl二进制包 github二进制包下载地址:https://github.com/etcd-io/etcd/releases wget https://github.com/etcd-io/etcd/releases/download/v3.5.8/etcd-v3.5.8-linux-amd64.tar.gz 3.docker-ce二进制包下载地址 二进制包下载地址:https://download.docker.com/linux/static/stable/x86_64/ 这里需要下载20.10.+版本 wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.23.tgz 4.下载cri-docker 二进制包下载地址:https://github.com/Mirantis/cri-dockerd/releases/ wget https://ghproxy.com/https://github.com/Mirantis/cri-dockerd/releases/download/v0.2.6/cri-dockerd-0.2.6.amd64.tgz 5.containerd二进制包下载 github下载地址:https://github.com/containerd/containerd/releases containerd下载时下载带cni插件的二进制包。 wget https://github.com/containerd/containerd/releases/download/v1.6.6/cri-containerd-cni-1.6.6-linux-amd64.tar.gz 6.下载cfssl二进制包 github二进制包下载地址:https://github.com/cloudflare/cfssl/releases wget https://github.com/cloudflare/cfssl/releases/download/v1.6.1/cfssl_1.6.1_linux_amd64 wget https://github.com/cloudflare/cfssl/releases/download/v1.6.1/cfssljson_1.6.1_linux_amd64 wget https://github.com/cloudflare/cfssl/releases/download/v1.6.1/cfssl-certinfo_1.6.1_linux_amd64 7.cni插件下载 github下载地址:https://github.com/containernetworking/plugins/releases wget https://github.com/containernetworking/plugins/releases/download/v1.1.1/cni-plugins-linux-amd64-v1.1.1.tgz 8.crictl客户端二进制下载 github下载:https://github.com/kubernetes-sigs/cri-tools/releases wget https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.24.2/crictl-v1.24.2-linux-amd64.tar.gz
1.3系统初始化
# 安装依赖包 yum -y install wget jq psmisc vim net-tools nfs-utils telnet yum-utils device-mapper-persistent-data lvm2 git network-scripts tar curl -y # 关闭防火墙 与selinux systemctl disable --now firewalld setenforce 0 sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config # 关闭交换分区 sed -ri 's/.*swap.*/#&/' /etc/fstab swapoff -a && sysctl -w vm.swappiness=0 cat /etc/fstab # /dev/mapper/centos-swap swap swap defaults 0 0 # # 配置系统句柄数 ulimit -SHn 65535 cat >> /etc/security/limits.conf <<EOF * soft nofile 655360 * hard nofile 131072 * soft nproc 655350 * hard nproc 655350 * seft memlock unlimited * hard memlock unlimitedd EOF # 做系统无密码互信登陆 yum install -y sshpass ssh-keygen -f /root/.ssh/id_rsa -P '' export IP="172.16.10.81 172.16.10.82 172.16.10.83" export SSHPASS=flyfish225 for HOST in $IP;do sshpass -e ssh-copy-id -o StrictHostKeyChecking=no $HOST done # 升级系统内核 rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org yum install https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm 修改阿里云 镜像源 mv /etc/yum.repos.d/elrepo.repo /etc/yum.repos.d/elrepo.repo.bak vim /etc/yum.repos.d/elrepo.repo ---- [elrepo-kernel] name=elrepoyum baseurl=https://mirrors.aliyun.com/elrepo/kernel/el8/x86_64/ enable=1 gpgcheck=0 ---- yum --enablerepo=elrepo-kernel install kernel-ml #使用序号为0的内核,序号0是前面查出来的可用内核编号 grub2-set-default 0 #生成 grub 配置文件并重启 grub2-mkconfig -o /boot/grub2/grub.cfg reboot
启用ipvs yum install ipvsadm ipset sysstat conntrack libseccomp -y mkdir -p /etc/modules-load.d/ cat >> /etc/modules-load.d/ipvs.conf <<EOF ip_vs ip_vs_rr ip_vs_wrr ip_vs_sh nf_conntrack ip_tables ip_set xt_set ipt_set ipt_rpfilter ipt_REJECT ipip EOF systemctl restart systemd-modules-load.service lsmod | grep -e ip_vs -e nf_conntrack ip_vs_sh 16384 0 ip_vs_wrr 16384 0 ip_vs_rr 16384 0 ip_vs 180224 6 ip_vs_rr,ip_vs_sh,ip_vs_wrr nf_conntrack 176128 1 ip_vs nf_defrag_ipv6 24576 2 nf_conntrack,ip_vs nf_defrag_ipv4 16384 1 nf_conntrack libcrc32c 16384 3 nf_conntrack,xfs,ip_vs
end.
标签:github,releases,二进制,https,k8s,com,1.26,下载 From: https://www.cnblogs.com/edeny/p/17391942.html