kubernetes整个基础环境的准备

1、三台centos7,用CentOS-7-x86_64-Minimal-1708.iso安装的,记得统一选好时区,这三台会有etcd集群,其中一台做kubernetes服务端(也可以做三台服务端做负载均衡和容灾备份),全都有kubernetes客户端。

2、关闭firewalld

# systemctl stop firewalld&&systemctl disable firewalld&&systemctl status firewalld

3、关闭selinux 

# setenforce 0
修改/etc/selinux/config 文件,将SELINUX=enforcing改为SELINUX=disabled

# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

4、设置系统参数 - 允许路由转发,不对bridge的数据进行处理写入配置文件

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

生效配置文件
# sysctl -p /etc/sysctl.d/k8s.conf

5、设置主机名

# hostnamectl set-hostname kube-node0

# cat <<EOF >> /etc/hosts
192.168.111.10 kube-node0
192.168.111.11 kube-node1
192.168.111.12 kube-node2
EOF

6、关闭 swap 分区
如果开启了 swap 分区,kubelet 会启动失败(可以通过将参数 --fail-swap-on 设置为 false 来忽略 swap on),故需要在每台机器上关闭 swap 分区:
# swapoff -a
为了防止开机自动挂载 swap 分区,可以注释 /etc/fstab 中相应的条目:
# sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab

7、时间同步

# yum -y install ntp

# ntpdate ntp1.aliyun.com

posted on 2018-09-17 15:25  徐应钟  阅读(231)  评论(0编辑  收藏  举报

导航