Ubuntu系统kubeadm安装K8S_v1.25.x容器使用docker(K8S_v1.24版本以后依然使用docker容器管理)
安装所需要的全部文档请点击这里下载
系统是:
root@k8s-master:~# cat /etc/lsb-release DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04 DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION=“Ubuntu 22.04.3 LTS” root@k8s-master:~# uname -a
Linux k8s-master 5.15.0-76-generic #83-Ubuntu SMP Thu Jun 15 19:16:32
UTC 2023 x86_64 x86_64 x86_64 GNU/Linux root@k8s-master:~#192.168.186.132 k8s-master01
192.168.186.133 k8s-node01
192.168.186.134 k8s-node02
hostnamectl set-hostname k8s-master01 && bash
hostnamectl set-hostname k8s-node01 && bash
hostnamectl set-hostname k8s-node02 && bash
sudo cat >> /etc/hosts << EOF
192.168.186.132 k8s-master01
192.168.186.133 k8s-node01
192.168.186.134 k8s-node02
EOF
sudo systemctl stop ufw && sudo systemctl disable ufw
1.基础环境部署
sudo apt-get update #更新源及/etc/apt/sources.list
sudo apt-get -y upgrade #更新已安装的软件包
sudo apt -y install vim lrzsz wget
sudo swapoff -a # 临时
sudo sed -i 's/.*swap.*/#&/' /etc/fstab # 永久
sudo timedatectl set-timezone Asia/Shanghai && sudo systemctl restart rsyslog
sudo apt install ntpdate -y && sudo ntpdate time.windows.com
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
sudo lsmod | grep br_netfilter
sudo cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sudo sysctl --system
sudo cat > /etc/sysctl.d/10-network-security.conf << EOF
net.ipv4.conf.default.rp_filter=1
net.ipv4.conf.all.rp_filter=1
EOFsudo sysctl --system
2.安装Docker和安装cri-dockerd插件
2.1 安装docker
sudo apt update && sudo apt-get -y upgrade
#卸载原来安装的
sudo apt-get remove docker docker-engine docker.io containerd runc
#安装必要的一些系统工具
apt -y install apt-transport-https ca-certificates curl software-properties-common