二进制安装k8s - 01. 服务器初始化
二进制安装k8s - 01. 服务器初始化实验环境这里最简单化。 一个master一个node一个etcd无高可用本次所有安装目录都在/data 下面192.168.100.59masteretcd192.168.100.60node最小化安装Centos7直接安装最新的centos7 最小镜像即可[root@master ~]# uname -aLinux master 3.10.0-1062.
·
二进制安装k8s - 01. 服务器初始化
k8s 版本为 :v1.15.6
实验环境
这里最简单化。 一个master 一个node 一个etcd 无高可用
本次所有安装目录都在 /data 下面
192.168.100.59 master etcd
192.168.100.60 node
最小化安装Centos7
直接安装最新的centos7 最小镜像即可
[root@master ~]# uname -a
Linux master 3.10.0-1062.el7.x86_64 #1 SMP Wed Aug 7 18:08:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
基本优化点
# 关闭 防火墙
systemctl stop firewalld
systemctl disable firewalld
# 关闭 SeLinux
setenforce 0
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
# 关闭 swap
swapoff -a
yes | cp /etc/fstab /etc/fstab_bak
cat /etc/fstab_bak |grep -v swap > /etc/fstab
# yum epel源
yum install wget -y
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum makecache
# 安装必备包
yum install -y vim wget lrzsz tree lsof rsync zip net-tools telnet
# 时间同步 (我这装机时就默认开启了)
#yum -y install chrony
#systemctl start chronyd
#systemctl enable chronyd
# 配置 limits
cat >> /etc/security/limits.conf << EOF
* soft nofile 65535
* hard nofile 65535
* soft nproc 65535
* hard nproc 65535
EOF
# 修改 /etc/sysctl.conf
cat << EOF > /etc/sysctl.conf
vm.swappiness = 0
net.ipv4.neigh.default.gc_stale_time=120
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.lo.arp_announce=2
net.ipv4.conf.all.arp_announce=2
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 1024
net.ipv4.tcp_synack_retries = 2
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
kernel.sysrq=1
net.ipv4.ip_forward = 1
EOF
sysctl -p
更多推荐
已为社区贡献40条内容
所有评论(0)