K8s 安装:修订间差异
跳到导航
跳到搜索
(创建页面,内容为“=== 环境准备 === ==== host ==== 192.168.0.158 np0 192.168.0.229 np1 192.168.0.249 np2 192.168.0.148 np3 ==== 设置网桥参数 ==== cat > /etc/sysctl.d/k8s.conf << EOF net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 net.ipv4.ip_forward = 1 EOF sysctl --system ==== ip_vs ==== 加载 ip_vs 内核模块。kube-proxy 通过采用 iptables + ipset + ipvs 的方式实现为符合条件的 Pod 提供负载均…”) |
(→环境准备) |
||
第1行: | 第1行: | ||
=== 环境准备 === | === 环境准备 === | ||
* 关闭 selinux 及 firewalld | |||
* 关闭 Swap | |||
==== host ==== | ==== host ==== | ||
192.168.0.158 np0 | 192.168.0.158 np0 | ||
第7行: | 第9行: | ||
==== 设置网桥参数 ==== | ==== 设置网桥参数 ==== | ||
cat > /etc/sysctl.d/ | cat << EOF > /etc/sysctl.d/99-kubernetes-cri.conf | ||
net.bridge.bridge-nf-call-ip6tables = 1 | net.bridge.bridge-nf-call-ip6tables = 1 | ||
net.bridge.bridge-nf-call-iptables = 1 | net.bridge.bridge-nf-call-iptables = 1 | ||
net.ipv4.ip_forward = 1 | net.ipv4.ip_forward = 1 | ||
user.max_user_namespaces=28633 | |||
EOF | EOF | ||
sysctl -- | sysctl -p /etc/sysctl.d/99-kubernetes-cri.conf | ||
==== 配置支持 IPVS ==== | |||
加载 ip_vs 内核模块。kube-proxy 通过采用 iptables + ipset + ipvs 的方式实现为符合条件的 Pod 提供负载均衡。否则 kube-proxy 会退回到 iptables 模式。 | |||
cat > /etc/modules-load.d/ip_vs.conf << EOF | |||
ip_vs | |||
ip_vs_rr | |||
ip_vs_wrr | |||
ip_vs_sh | |||
nf_conntrack_ipv4 | |||
EOF | |||
modprobe ip_vs | modprobe ip_vs | ||
modprobe ip_vs_rr | modprobe ip_vs_rr | ||
第23行: | 第34行: | ||
modprobe nf_conntrack_ipv4 | modprobe nf_conntrack_ipv4 | ||
==== 导入模块 ==== | |||
cat > /etc/modules-load.d/ | cat << EOF > /etc/modules-load.d/containerd.conf | ||
overlay | |||
br_netfilter | |||
EOF | EOF | ||
modprobe overlay | |||
modprobe br_netfilter | |||
lsmod | grep overlay | |||
lsmod | grep br_netfilter | |||
=== kubernetes === | === kubernetes === |
2024年3月25日 (一) 17:30的版本
环境准备
- 关闭 selinux 及 firewalld
- 关闭 Swap
host
192.168.0.158 np0 192.168.0.229 np1 192.168.0.249 np2 192.168.0.148 np3
设置网桥参数
cat << EOF > /etc/sysctl.d/99-kubernetes-cri.conf net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 net.ipv4.ip_forward = 1 user.max_user_namespaces=28633 EOF sysctl -p /etc/sysctl.d/99-kubernetes-cri.conf
配置支持 IPVS
加载 ip_vs 内核模块。kube-proxy 通过采用 iptables + ipset + ipvs 的方式实现为符合条件的 Pod 提供负载均衡。否则 kube-proxy 会退回到 iptables 模式。
cat > /etc/modules-load.d/ip_vs.conf << EOF ip_vs ip_vs_rr ip_vs_wrr ip_vs_sh nf_conntrack_ipv4 EOF
modprobe ip_vs modprobe ip_vs_rr modprobe ip_vs_wrr modprobe ip_vs_sh modprobe nf_conntrack_ipv4
导入模块
cat << EOF > /etc/modules-load.d/containerd.conf overlay br_netfilter EOF
modprobe overlay modprobe br_netfilter
lsmod | grep overlay lsmod | grep br_netfilter
kubernetes
repo
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=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
kubelet kubeadm kubectl
# yum list kubelet --showduplicates yum install kubelet kubeadm kubectl systemctl enable kubelet