系统环境准备

1、检查时区

  date命令显示为CST

2、修改主机名

  • 查看主机名称

    hostname 或 hostnamectl

  • 修改主机名称

    命令方式:hostnamectl set-hostname kube-master-1

    修改配置文件:vi /etc/hostname

      在Centos7.5中 /etc/sysconfig/network 文件已废弃,主机名称不使用该文件

  • 修改hosts文件(最好修改一下):

    行尾添加新主机名

    vi /etc/hosts

      127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 kube-master-1

      ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

2、新建用户赋予sudo权限

  • 新建用户

 

  groupadd --gid 2000 yunwei 

 

  useradd --uid 2000 yunwei -g yunwei

 

  passwd yunwei(yunwei)

  • 赋权

  visudo

  在# %wheel        ALL=(ALL)       NOPASSWD: ALL下添加:

  yunwei   ALL=(ALL)       NOPASSWD: ALL

 

3、关闭防火墙

  • 查看防火墙状态

    systemctl status firewalld

  • 永久关闭防火墙

    systemctl stop firewalld.service #停止firewall

    systemctl disable firewalld.service #禁止firewall开机启动

  • 无需重启主机,再次查看状态确认即可

4、关闭SELinux

  • 查看SELinux状态

    getenforce

  • 参数说明

    enforcing:开启

    disabled:关闭

  • 临时关闭

    setenforce 0

  • 永久关闭

    vi /etc/sysconfig/selinux

    将SELINUX=enforcing 改为 SELINUX=disabled

  • 必须重启主机后生效

 

 6、主机内核参数

  • 修改/etc/sysctl.conf

    vi /etc/sysctl.conf

    保存后执行  sysctl -p

fs.aio-max-nr = 4194304
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
net.core.somaxconn = 32768
net.core.netdev_max_backlog = 30000
net.core.optmem_max = 4194304
net.core.netdev_budget = 900
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_wmem = 8192 436600 4194304
net.ipv4.tcp_rmem = 32768 436600 4194304
net.ipv4.tcp_mem = 94500000 91500000 92700000
net.ipv4.ip_local_port_range = 9000 65500
net.ipv4.tcp_adv_win_scale = 1
net.ipv4.tcp_sack = 1
net.ipv4.tcp_fin_timeout = 10
net.ipv4.tcp_keepalive_intvl = 15
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_keepalive_time = 1800
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-arptables = 1
net.netfilter.nf_conntrack_max = 1048576

vm.dirty_ratio = 5
vm.dirty_background_ratio = 3
vm.dirty_writeback_centisecs = 100
vm.dirty_expire_centisecs = 500
vm.min_free_kbytes = 524288
vm.vfs_cache_pressure = 1000
vm.swappiness = 1
vm.max_map_count = 2621440

 

  • 修改/etc/security/limits.conf

    vi /etc/security/limits.conf

*  soft    nproc   131072
*  soft    nofile  65536
*  hard    nproc   131072
*  hard    nofile  65536
  • 修改/etc/security/limits.d/20-nproc.conf

    vi /etc/security/limits.d/20-nproc.conf

*    soft    nproc     131072 

 7、配置yum源

  配置好repo文件后执行一下命令更新yum源

  scp root@137.32.117.49:/etc/yum.repos.d/Centos-Base.repo ./

  • 清除原有yum源

    yum clean all

  • 加载yum源

    yum makecache

  • 查看yum源

    yum repolist all

posted @ 2019-04-01 23:09  人间丶迷走  阅读(302)  评论(0编辑  收藏  举报