2 Star 0 Fork 0

zdb_cn/k8s-deploy

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
initEnv.sh 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
zdb_cn 提交于 2018-10-01 16:50 . k8s v1.11.3部署文件
#! /bin/bash
# 需要设置的主机名,以空格间隔
hosts="e131 e132"
for host in $hosts;
do
echo $host;
# 关闭防火墙
ssh $host "systemctl stop firewalld & systemctl disable firewalld";
# 禁用swap
ssh $host "swapoff -a & sed -i 's/.*swap.*/#&/' /etc/fstab";
# 关闭selinux
ssh $host "setenforce 0 & sed -i \"s/^SELINUX=enforcing/SELINUX=disabled/g\" /etc/sysconfig/selinux & sed -i \"s/^SELINUX=enforcing/SELINUX=disabled/g\" /etc/selinux/config & sed -i \"s/^SELINUX=permissive/SELINUX=disabled/g\" /etc/sysconfig/selinux & sed -i \"s/^SELINUX=permissive/SELINUX=disabled/g\" /etc/selinux/config";
# 设置ip 转发
ssh $host "echo \"1\" > /proc/sys/net/ipv4/ip_forward & modprobe br_netfilter & cat <<EOF > /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF";
ssh $host "sysctl -p /etc/sysctl.d/k8s.conf & ls /proc/sys/net/bridge";
# 设置内核参数,文件打开数
ssh -T $host <<EOF
echo "* soft nofile 65536" >> /etc/security/limits.conf
echo "* hard nofile 65536" >> /etc/security/limits.conf
echo "* soft nproc 65536" >> /etc/security/limits.conf
echo "* hard nproc 65536" >> /etc/security/limits.conf
echo "* soft memlock unlimited" >> /etc/security/limits.conf
echo "* hard memlock unlimited" >> /etc/security/limits.conf
EOF
done
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/zdb_cn/k8s-deploy.git
git@gitee.com:zdb_cn/k8s-deploy.git
zdb_cn
k8s-deploy
k8s-deploy
master

搜索帮助