1 配置环境

关闭firewalld

关闭selinux

配置hosts

安装yum install bridge-utils -y

modprobe overlay

modprobe br_netfilter

cat /etc/sysctl.d/

vim k8s.conf

net.bridge.bridge-nf-call-ip6tables = 1

net.bridge.bridge-nf-call-iptables = 1

vim 99-kubernetes-cri.conf

net.bridge.bridge-nf-call-iptables = 1

net.ipv4.ip_forward = 1

net.bridge.bridge-nf-call-ip6tables = 1

sysctl --system

cat /etc/modules-load.d/br_netfilter.conf

br_netfilter

cat containerd.conf

overlay

br_netfilter

cat k8s.conf

br_netfilter

2 安装docker环境

sudo yum update -y 更新系统

sudo yum install -y yum-utils device-mapper-persistent-data lvm2 安装yum软件包

sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo 安装docker的yum源

yum list docker-ce --showduplicates | sort -r 查看docker的所有版本

yum install docker-ce.x86-64 安装默认的最新稳定版

systemctl start docker

systemctl enable docker 启动docker并放入开机启动项

3 配置docker的cgroup

vim /etc/docker/daemon.json

{ "exec-opts": ["native.cgroupdriver=systemd"], "log-driver": "json-file", "log-opts": { "max-size": "100m" }, "storage-driver": "overlay2" }

systemctl daemon-reload

systemctl restart docker

如果docker起不来报错修改为

{

"exec-opts":["native.cgroupdriver=systemd"]

}

docker info|grep "Cgroup Driver" 检测是否成功修改

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐