关闭防火墙 swap
systemctl stop firewalld
systemctl disable firewalld
iptables -F && iptables -X && iptables -F -t nat && iptables -X -t nat
iptables -P FORWARD ACCEPT
swapoff -a
sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
setenforce 0
sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
添加hosts
cat >> /etc/hosts <
10.1.102.200 ceph10
10.1.102.201 ceph11
10.1.102.202 ceph12
EOF
全部安装docker
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum -y install docker-ce
mkdir -p /etc/docker
cat >/etc/docker/daemon.json <
{
"exec-opts": ["native.cgroupdriver=systemd"],
"registry-mirrors": [
"https://docker.mirrors.ustc.edu.cn/",
"https://reg-mirror.qiniu.com",
"http://hub-mirror.c.163.com/",
"https://registry.docker-cn.com"
],
"storage-driver": "overlay2",
"storage-opts": [
"overlay2.override_kernel_check=true"
],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m",
"max-file": "3"
}
}
EOF
systemctl enable --now docker
systemctl restart docker
安装ranchar 2.5.3
https://docs.rancher.cn/rancher2/
创建rancher容器
mkdir -p /opt/rancher
#最后一个版本,测试版
docker run -d --restart=unless-stopped -p 1180:80 -p 11443:443 -v /opt/rancher:/var/lib/rancher/ --privileged rancher/rancher:latest
需要开启特权模式,稳定版
docker run -d --restart=unless-stopped -p 1180:80 -p 11443:443 -v /opt/rancher:/var/lib/rancher/ --privileged rancher/rancher:stable
等安装完成,直接打开
https://10.1.102.200:11443/
admin
admin
进入后,右下解改成中文,再创建自义的K8S集群就可以了,然后等待就行,如下想看有啥错误,可以直接查看
docker logs rancharId
g下一步
在三台中,启用上面的命令就OK
下载kubectl,配置.kube/config,就可以在命令行下使用K8S了
阅读(2181) | 评论(0) | 转发(0) |