Kubernetes 搭建之配置 CentOS7 环境

Kubernetes CentOS About 950 words

配置

如果在Hyper-V或者VMware等虚拟机中配置,master节点至少1500MB2CPUnode节点至少512MB

设置 hostname

三台机器分别设置hostname

hostnamectl set-hostname k8s-master
hostnamectl set-hostname k8s-node1
hostnamectl set-hostname k8s-node2 

配置 hosts

三台机器都添加hosts

cat >> /etc/hosts << EOF
192.168.3.100 k8s-master
192.168.3.101 k8s-node1
192.168.3.102 k8s-node2
EOF

时间同步

yum install ntpdate -y
ntpdate time.windows.com

关闭 selinux

sed -i 's/enforcing/disabled/' /etc/selinux/config

关闭防火墙

systemctl stop firewalld
systemctl disable firewalld

关闭 iptables

systemctl stop iptables
systemctl disable iptables

设置 Kubernetes 配置

将桥接的IPv4流量传递到iptables的链。

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 -p

加载网桥过滤模块

modprobe br_netfilter

查看网桥过滤模块是否加载成功

lsmod | grep br_netfilter

关闭 swap

临时关闭

swapoff -a

永久关闭:编辑/etc/fstab,注释掉有swap的那一行,一般在最后一行。

vim /etc/fstab

重启机器

reboot
Views: 1,619 · Posted: 2022-03-03

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh