centos7配置为kubernetes节点准备工作

# 修改主机名,设置后注销重新登录即可
hostnamectl set-hostname nodexxx.localdomain.local && logout
 
# 同步公网时间(无法访问公网需要配置指向内网ntp服务器)
yum install chrony
systemctl start chronyd
systemctl enable chronyd
chronyc tracking  # 校准时间
timedatectl set-ntp yes  # 启用NTP时间同步
chronyc sources -v # 查看时间同步源状态
chronyc sourcestats -v # 查看时间同步源状态
 
# 关闭selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
 
# 修改系统参数,退出再登录生效
# 查看当前值
ulimit -a
## 当前open files=1024 max user processes=7273

# 调整默认文件句柄
cat >> /etc/security/limits.conf << EOF
* soft nofile 65536
* hard nofile 65536
EOF
logout

# 查看系统最大文件句柄数
## sysctl -a|grep fs.file-max
 
# 使用阿里repo源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all && yum repolist
 
# 关闭无用的服务和防火墙
systemctl disable postfix.service  #邮件服务 占用25端口
systemctl stop postfix.service
systemctl stop firewalld    #防火墙
systemctl mask firewalld    #注销服务 将服务文件指向/dev/null 服务将不再可用 
# 反注销 systemctl unmask firewalld
 
# 调整内核参数
cat >> /etc/sysctl.conf << EOF
net.ipv4.ip_forward=1
watchdog_thresh=30
net.bridge.bridge-nf-call-iptables=1
net.ipv4.neigh.default.gc_thresh1=4096
net.ipv4.neigh.default.gc_thresh2=6144
net.ipv4.neigh.default.gc_thresh3=8192
EOF
modprobe br_netfilter
sysctl -p

# docker-ce安装
# step 1: 安装必要的一些系统工具
yum install -y yum-utils device-mapper-persistent-data lvm2
# Step 2: 添加软件源信息
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# Step 3: 更新并安装Docker-CE
yum makecache fast
yum -y install docker-ce
# Step 4: 配置Docker服务
touch /etc/docker/daemon.json
cat > /etc/docker/daemon.json <<EOF
{
    "oom-score-adjust": -1000,
    "log-driver": "json-file",
    "log-opts": {
    "max-size": "100m",
    "max-file": "3"
    },
    "max-concurrent-downloads": 10,
    "max-concurrent-uploads": 10,
    "bip": "172.17.199.0/24",
    "registry-mirrors": ["https://7bezldxe.mirror.aliyuncs.com"],
    "storage-driver": "overlay2",
    "storage-opts": [
    "overlay2.override_kernel_check=true"
    ]
}
EOF

# 启动docker服务
systemctl daemon-reload && systemctl restart docker
posted @   longtds  阅读(107)  评论(0编辑  收藏  举报
编辑推荐:
· 使用 .NET Core 实现一个自定义日志记录器
· [杂谈]如何选择:Session 还是 JWT?
· 硬盘空间消失之谜:Linux 服务器存储排查与优化全过程
· JavaScript是按顺序执行的吗?聊聊JavaScript中的变量提升
· [杂谈]后台日志该怎么打印
阅读排行:
· 2000 Star,是时候为我的开源项目更新下功能了
· 面试官:DNS解析都整不明白,敢说你懂网络?我:嘤嘤嘤!
· [WPF UI] 为 AvalonDock 制作一套 Fluent UI 主题
· 基于.NET WinForm开发的一款硬件及协议通讯工具
· 内网穿透之http代理服务器
点击右上角即可分享
微信分享提示