k8安装前环境准备

安装前要求

参见官网

使用环境

centos 7.2 , 两台 8c 16g 。

[root@docker01 ~]# uname -r
3.10.0-327.el7.x86_64
[root@docker01 ~]# cat /etc/system-release
CentOS Linux release 7.2.1511 (Core)

设置yum 阿里源

下载 Centos-7.repo , http://mirrors.aliyun.com/repo/Centos-7.repo 。
替换里面的$release 为7 。

设置yum 代理

在/etc/yum.conf中配置内外代理地址 :

proxy=http://10.30.127.84:1808

执行yum clean all
yum makecache

设置hostname

编辑 /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.30.16.205 node205
10.30.16.206 node206

编辑/etc/sysconfig/network

HOSTNAME=node205

编辑/etc/hostname

node205

关闭防火墙

[root@docker01 ~]# systemctl stop firewalld
[root@docker01 ~]# systemctl disable firewalld

关闭swap

使用 free -h 查看 ,关闭前后 :

[root@docker02 yum.repos.d]# free -h
              total        used        free      shared  buff/cache   available
Mem:            15G        184M         14G        8.4M        416M         15G
Swap:          8.0G          0B        8.0G

[root@docker01 ~]# swapoff -a

[root@docker01 ~]# free -h
              total        used        free      shared  buff/cache   available
Mem:            15G        179M         14G        8.4M        420M         15G
Swap:            0B          0B          0B

编辑配置文件: /etc/fstab , 注释最后一条

/dev/mapper/centos-root /                       xfs     defaults        0 0
UUID=3edeec3d-1be5-4cf4-9fc3-9141d92baba8 /boot                   xfs     defaults        0 0
#/dev/mapper/centos-swap swap                    swap    defaults        0 0

关闭 SeLinux

vim /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled

检查使用 getenfore

配置ntp

  1. 安装ntp , yum install ntp
  2. 配置/etc/ntp.conf
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 10.20.11.10
server 0.centos.pool.ntp.org iburst

  1. 开机启动 及 同步
[root@docker02 yum.repos.d]# systemctl enable ntpd
Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.
[root@docker02 yum.repos.d]# systemctl start ntpd

[root@docker02 yum.repos.d]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 10.20.11.10     .GPS.            1 u    6   64    1    1.904  8546.08   0.000
[root@docker02 yum.repos.d]# 
[root@docker02 yum.repos.d]# 
[root@docker02 yum.repos.d]# ntpdate -u 10.20.11.10
20 Jun 20:17:14 ntpdate[12110]: step time server 10.20.11.10 offset 8.545657 sec

安装最新docker ce

见本人docker 安装 : https://www.jianshu.com/p/cc581897c00c

ulimit

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

安装 命令补全

yuminstallepel-release

yum install -y bash-completion
source /usr/share/bash-completion/bash_completion
source <(kubectl completion bash)
echo "source <(kubectl completion bash)" >> ~/.bashrc

你可能感兴趣的:(k8安装前环境准备)