k8s搭建和helm安装-centos傻瓜版
k8s资源文件 链接:链接:pan.xunlei.com/s/VNcRqiJIe…
docker安装
# 安装yum工具
yum install -y yum-utils \ device-mapper-persistent-data \ lvm2 --skip-broken
# 更新本地镜像源
yum-config-manager \
--add-repo \
https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sed -i 's/download.docker.com/mirrors.aliyun.com\/docker-ce/g' /etc/yum.repos.d/docker-ce.repo
yum makecache fast
# 安装docker
yum install -y docker-ce
# 启动docker服务
systemctl start docker
# 配置docker.daemon.json(非必须)
{
"registry-mirrors": ["https://82m9ar63.mirror.aliyuncs.com"],
"exec-opts": ["native.cgroupdriver=systemd"]
}
# 重启 docker 配置和服务
sudo systemctl daemon-reload
sudo systemctl restart docker
# docker验证
docker info
k8s安装准备
# 关闭swap(注释掉swap那行)
swapoff -a
sed -i 's/.*swap.*/#&/' /etc/fstab
# 关闭selinux:
sed -i 's/enforcing/disabled/' /etc/selinux/config # 永久
setenforce 0 # 临时
sudo su
# 关闭防火墙
service firewalld stop
# 设置主机名(hostname与添加到hosts中的name要保持一致)
hostnamectl set-hostname
# 在master添加hosts:
cat >> /etc/hosts /etc/sysctl.d/k8s.conf