关于kubeadm:Kubeadm搭建高可用集群02组件安装

Containerd作为Runtime所有节点装置docker-ce-20.10: yum install docker-ce-20.10.* docker-ce-cli-20.10.* -y配置Containerd所需的模块(所有节点): cat <<EOF | sudo tee /etc/modules-load.d/containerd.confoverlaybr_netfilterEOF所有节点加载模块: modprobe -- overlaymodprobe -- br_netfilter所有节点,配置Containerd所需的内核: cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.confnet.bridge.bridge-nf-call-iptables = 1net.ipv4.ip_forward = 1net.bridge.bridge-nf-call-ip6tables = 1EOF所有节点加载内核: sysctl --system所有节点配置Containerd的配置文件: mkdir -p /etc/containerdcontainerd config default | tee /etc/containerd/config.toml所有节点将Containerd的Cgroup改为Systemd: vim /etc/containerd/config.toml找到containerd.runtimes.runc.options,增加SystemdCgroup = true [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options] SystemdCgroup = true所有节点将sandbox_image的Pause镜像改成合乎本人版本的地址 sandbox_image = "registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.6"所有节点启动Containerd,并配置开机自启动: systemctl daemon-reloadsystemctl enable --now containerd所有节点配置crictl客户端连贯的运行时地位: cat > /etc/crictl.yaml <<EOFruntime-endpoint: unix:///run/containerd/containerd.sockimage-endpoint: unix:///run/containerd/containerd.socktimeout: 10debug: falseEOFDocker作为Runtime(版本小于1.24)所有节点装置docker-ce 20.10: yum install docker-ce-20.10.* docker-ce-cli-20.10.* -yCgroupDriver改成systemd: ...

July 5, 2023 · 3 min · jiezi

关于kubeadm:Kubeadm搭建高可用集群01环境准备

全局配置xshell批量批改:发送键输出到 -> 所有会话 1.批改hosts vim /etc/hosts192.168.2.201 k8s-master01192.168.2.202 k8s-master02192.168.2.203 k8s-master03192.168.2.236 k8s-master-lb # 如果不是高可用集群,该IP为Master01的IP192.168.2.204 k8s-node01192.168.2.205 k8s-node022.更新yum源 curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repoyum install -y yum-utils device-mapper-persistent-data lvm2yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repocat <<EOF > /etc/yum.repos.d/kubernetes.repo[kubernetes]name=Kubernetesbaseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/enabled=1gpgcheck=1repo_gpgcheck=1gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpgEOFsed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo装置依赖 yum install wget jq psmisc vim net-tools telnet yum-utils device-mapper-persistent-data lvm2 git -y所有节点敞开防火墙、selinux、dnsmasq、swap systemctl disable --now firewalld systemctl disable --now dnsmasqsystemctl disable --now NetworkManagersetenforce 0sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/sysconfig/selinuxsed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config敞开swap分区 swapoff -a && sysctl -w vm.swappiness=0sed -ri '/^[^#]*swap/s@^@#@' /etc/fstab装置ntpdate ...

July 4, 2023 · 2 min · jiezi