Debian系统在线安装rancher2.4管理K8S集群并部署服务

条件:
一台可以上网的机器,系统是Debian

1.服务器和系统查看

root@master:~# uname -a
Linux master 5.10.0-19-amd64 #1 SMP Debian 5.10.149-2 (2022-10-21) x86_64 GNU/Linux
root@master:~# cat /etc/issue
Debian GNU/Linux 11 \n \l
root@master:~# 

2. 系统基础优化,全部节点操作

hostnamectl set-hostname master &&  bash
cat >> /etc/hosts << EOF
192.168.0.84 master
EOF

ufw status #查看防火墙状态
#ufw enable #开启
ufw disable #关闭

swapoff -a && sed -i 's/.*swap.*/#&/' /etc/fstab ##关闭swap
cat > /etc/sysctl.d/k8s.conf << EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system # 生效

3. 安装docker

3.1 使用脚本安装docker

curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh --mirror Aliyun
systemctl enable docker
systemctl start docker
systemctl cat docker | grep '\-\-registry\-mirror' #配置镜像加速
cat > /etc/docker/daemon.json <<EOF
{
  "registry-mirrors": [
    "https://hub-mirror.c.163.com",
    "https://mirror.baidubce.com"
  ],
  "insecure-registries":["192.168.0.84:5000"]
}
EOF

4.安装rancher

#安装rancher服务,192.168.0.84:5000是内网的仓库地址,请修改
docker run -d --restart=unless-stopped --privileged   \
  -p 8080:80 -p 8443:443   \
  -v /opt/rancher:/var/lib/rancher    \
  -v /var/log/rancher/auditlog:/var/log/auditlog    \
  --name rancher2 rancher/rancher:v2.4.17

#稍等几分钟访问服务路径:https://192.168.0.84:8443,现场请访问对应的路径,就可以看到rancher2.4的页面

4. 页面登录rancher

登录后续的其他操作请查看博客,从第4步开始看
https://blog.csdn.net/qq_14910065/article/details/130116928

你可能感兴趣的:(kubernetes,linux,debian,kubernetes,linux)