k8s-基础环境配置(六)

hostname配置
1)修改主机名
hostnamectl set-hostname xxx
2)加入主机映射
vim /etc/hosts
……
关闭selinux
sed -i '/^SELINUX/s/=.*/=disabled/' /etc/selinux/config
setenforce 0
修改Linux最大打开文件数
vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
关闭防火墙
systemctl disable firewalld.service
systemctl stop firewalld.service
systemctl status firewalld.service
初始化服务器
groupadd -g 6000 apps
useradd -s /bin/sh -g apps -d /home/app app
passwd app
yum -y install gcc gcc-c++ make autoconfig openssl-devel supervisor gmp-devel mpfr-devel libmpc-devel libaio numactl autoconf automake libtool libffi-dev
2)配置sudo
vim /etc/sudoers.d/app
app ALL=(ALL) ALL
app ALL=(ALL) NOPASSWD: ALL
Defaults !env_reset
配置ssh无密登录
1) app用户下执行
su app
ssh-keygen -t rsa
2)合并id_rsa_pub文件
在192.168.0.1 app用户下执行
cat ~/.ssh/id_rsa.pub >> /home/app/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
scp ~/.ssh/authorized_keys app@192.168.0.2:/home/app/.ssh
输入密码:xxx
在192.168.0.2 app用户下执行
cat ~/.ssh/id_rsa.pub >> /home/app/.ssh/authorized_keys
scp ~/.ssh/authorized_keys app@192.168.0.3:/home/app/.ssh
输入密码:xxx
在192.168.0.3 app用户下执行
cat ~/.ssh/id_rsa.pub >> /home/app/.ssh/authorized_keys
scp ~/.ssh/authorized_keys app@192.168.0.1:/home/app/.ssh
scp ~/.ssh/authorized_keys app@192.168.0.2:/home/app/.ssh
覆盖之前的文件
输入密码:xxx
3)测试
ssh app@192.168.0.1
ssh app@192.168.0.2
ssh app@192.168.0.3
sysctl参数配置
vim /etc/sysctl.conf
net.bridge.bridge-nf-call-iptables=1
net.bridge.bridge-nf-call-ip6tables=1
net.ipv4.ip_forward=1
net.ipv4.tcp_tw_recycle=0
vm.swappiness=0
vm.overcommit_memory=1
vm.panic_on_oom=0
fs.inotify.max_user_watches=89100
fs.file-max=52706963
fs.nr_open=52706963
net.ipv6.conf.all.disable_ipv6=1
net.netfilter.nf_conntrack_max=2310720
#生效
sysctl –p

原文地址:https://www.cnblogs.com/xinfang520/p/11609016.html