k8s在线安装手册
目录
1.环境准备
编号 | 操作系统 | HOSTNAME | IP地址 |
---|---|---|---|
1 | centos7 | k8s-master | 192.168.154.128 |
2 | centos7 | k8s-node1 | 192.168.154.129 |
3 | centos7 | k8s-node2 | 192.168.154.130 |
4 | centos7 | k8s-node3 | 192.168.154.131 |
1.1修改hosts
4台主机分别修改hosts文件,添加如下内容
vi /etc/hosts
192.168.154.128 k8s-master
192.168.154.129 k8s-node1
192.168.154.130 k8s-node2
192.168.154.131 k8s-node3
1.2 修改hostsname
以下是主机1修改方式,主机2,3,4同理修改为k8s-node1,k8s-node2,k8s-node3
hostnamectl set-hostname k8s-master
1.3 关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
1.4 关闭 selinux
sed -i 's/enforcing/disabled/' /etc/selinux/config
setenforce 0
1.5 关闭 swap
swapoff -a #临时
sed -ri 's/.*swap.*/#&/' /etc/fstab #永久
1.6修改 /etc/sysctl.conf
将桥接的 IPv4 流量传递到 iptables 的链
如果有配置,则修改
sed -i "s#^net.ipv4.ip_forward.*#net.ipv4.ip_forward=1#g" /etc/sysctl.conf
sed -i "s#^net.bridge.bridge-nf-call-ip6tables.*#net.bridge.bridge-nf-call-ip6tables=1#g" /etc/sysctl.conf
sed -i "s#^net.bridge.bridge-nf-call-iptables.*#net.bridge.