kubernetes学习系列安装篇--第一篇:环境准备

0.系统准备

==注:==第一篇需要在所有机器上执行

  • centos7
  • 4cpu 8Gmem 500Gdisk
  • 内核>=3.10.0-957.21.3.el7.x86_64
  • 所有操作都在root用户下操作
hostname角色
host1master1
host2master2
host3master3
host4node1
host5node2
host6node3
host7私有仓库nexus

全程课程使用的材料到我的网盘下载,提取码:uloz

1.环境配置

方案一:使用我的材料

tar -zxf nexus3.tar.gz
cd nexus3
bash init_environment.sh

方案二: 手动配置环境

### env
# close firewall
systemctl stop firewalld
systemctl disable firewalld
iptables -F
# close swaoff
swapoff -a
sed -i ‘/ swap / s/^\(.*\)$/#\1/g‘ /etc/fstab
# disable selinux
setenforce 0
sed -i ‘s/^SELINUX=enforcing/SELINUX=disabled/g‘ /etc/selinux/config
# allow create br
echo """
vm.swappiness = 0
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
""" >> /etc/sysctl.conf

2.更换yum源

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3.安装docker

yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce -y

配置docker源

mkdir -p /etc/docker
vim /etc/docker/daemon.json
{
  "registry-mirrors" : [
    "http://md4nbj2f.mirror.aliyuncs.com",
    "http://registry.docker-cn.com",
    "http://docker.mirrors.ustc.edu.cn",
    "http://hub-mirror.c.163.com"
  ],
  "insecure-registries" : [
    "registry.docker-cn.com",
    "docker.mirrors.ustc.edu.cn"
  ],
  "debug" : true,
  "experimental" : true
}

启动docker

systemctl start docker
systemctl enable docker.service
systemctl status docker