美文网首页DevOps
04-k8s集群安装-前置环境

04-k8s集群安装-前置环境

作者: 紫荆秋雪_文 | 来源:发表于2021-08-16 09:21 被阅读0次

一、安装要求

  • 一台或多台机器,操作系统 CentOS7.x-86_x64
  • 硬件配置:2GB 或更多 RAM,2 个 CPU 或更多 CPU,硬盘 30GB 或更多
  • 集群中所有机器之间网络互通
  • 可以访问外网,需要拉取镜像
  • 禁止 swap 分区

二、系统初始化

1、关闭防火墙

systemctl stop firewalld

systemctl disable firewalld

2、关闭 selinux

setenforce 0 # 临时

sed -i 's/enforcing/disabled/' /etc/selinux/config # 永久

3、 关闭 swap

swapoff -a # 临时

sed -ri 's/.*swap.*/#&/' /etc/fstab 永久

4、设置主机名

hostnamectl set-hostname <hostname>

5、在 master 添加 hosts

vi /etc/hosts
172.16.176.100 k8s-master
172.16.176.101 k8s-node1
172.16.176.102 k8s-node2

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

cat > /etc/sysctl.d/k8s.conf << EOF 
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1 
EOF

sysctl --system # 生效

7、时间同步

yum install ntpdate -y
ntpdate cn.pool.ntp.org

相关文章

网友评论

    本文标题:04-k8s集群安装-前置环境

    本文链接:https://www.haomeiwen.com/subject/tfyubltx.html