首页
  • 2024.1.1.0
  • 2024.1.1.1
  • 2024.1.2.0
  • 2024.1.3.0
  • Java
  • Linux
  • Deploy
  • Application
关于
友情链接
GitHub (opens new window)

Xiao ku

板砖师傅
首页
  • 2024.1.1.0
  • 2024.1.1.1
  • 2024.1.2.0
  • 2024.1.3.0
  • Java
  • Linux
  • Deploy
  • Application
关于
友情链接
GitHub (opens new window)
  • Docker一键部署
  • Mysql主从配置一键化
  • Mysql新建主从同步-mysqldump
  • SkyWalking部署及使用
  • Prometheus部署及使用
  • K8S-CICD
  • K8S-在线安装
  • K3S-在线安装
    • 服务器
    • 安装-K3S
      • 安装docker
      • Server安装
      • agent安装
      • 查看状态
      • 查看节点
    • 安装Rancher
      • 安装docker
      • 放开防火墙
      • 重启docker
      • 使用docker启动
      • 浏览器访问
      • 与k3s关联
  • K3S-CICD
  • Deploy
xiaoku
2023-03-13
目录

K3S-在线安装

官方GitHub:https://github.com/k3s-io/k3s (opens new window)

# 服务器

192.168.213.201:Server
192.168.213.202:Agent
192.168.213.203:Rancher
1
2
3

# 安装-K3S

# 安装docker

yum remove -y docker docker-io docker-selinux python-docer-py
yum -y install yum-utils
yum-config-manager   --add-repo   http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum -y install docker-ce 
systemctl start docker
systemctl enable docker
systemctl status docker
1
2
3
4
5
6
7

# Server安装

hostnamectl set-hostname master-201
curl -sfL https://get.k3s.io | sh -s - server --docker
1
2

查看token

cat /var/lib/rancher/k3s/server/node-token
1

# agent安装

hostnamectl set-hostname agent-202
curl -sfL https://get.k3s.io | INSTALL_K3S_MIRROR=cn K3S_URL=https://${server_ip}:6443 K3S_TOKEN=${node_token} sh -s - --docker
1
2

# 查看状态

systemctl status k3s

# 查看节点

kubectl get nodes

# 安装Rancher

# 安装docker

不再描述

# 放开防火墙

systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
swapoff -a
yes | cp /etc/fstab /etc/fstab_bak
cat /etc/fstab_bak |grep -v swap > /etc/fstab
sed -i "s#^net.ipv4.ip_forward.*#net.ipv4.ip_forward=1#g"  /etc/sysctl.conf
sed -i "s#^net.bridge.bridge-nf-call-ip6tables.*#net.bridge.bridge-nf-call-ip6tables=1#g"  /etc/sysctl.conf
sed -i "s#^net.bridge.bridge-nf-call-iptables.*#net.bridge.bridge-nf-call-iptables=1#g"  /etc/sysctl.conf
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
echo "net.bridge.bridge-nf-call-ip6tables = 1" >> /etc/sysctl.conf
echo "net.bridge.bridge-nf-call-iptables = 1" >> /etc/sysctl.conf
sysctl -p
1
2
3
4
5
6
7
8
9
10
11
12
13
14

# 重启docker

不再描述

# 使用docker启动

docker run -d -v /data/docker/rancher-server/var/lib/rancher/:/var/lib/rancher/ --restart=unless-stopped --privileged --name rancher-server -p 8082:80 -p 8443:443 rancher/rancher:stable
1

# 浏览器访问

192.168.213.203:8082

设置密码,点击继续

填写可以访问的地址

# 与k3s关联

导入集群

填写

在k3s server 上请求 rancher 服务器地址

复制命令执行

查看界面

出现这个提示说明Rancher已经收到K3S的注册请求,正在完成K3S集群的注册工作,再等数十秒种的时间即可完成K3S集群的导入工作:等待中

完成

上次更新: 2023/03/14, 05:49:29
K8S-在线安装
K3S-CICD

← K8S-在线安装 K3S-CICD→

Copyright © 2019-2024
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式