Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

k3s跨云组建集群 #52

Open
dalaolala opened this issue Nov 3, 2023 · 0 comments
Open

k3s跨云组建集群 #52

dalaolala opened this issue Nov 3, 2023 · 0 comments

Comments

@dalaolala
Copy link
Owner

dalaolala commented Nov 3, 2023

k3s和k8s相比,耗用的系统资源比较少,因此适合低配置的vps服务器进行组建集群。

至于配置有多低,可以参考官方,用1C 512M的机器都能跑起来。

集群搭建的过程中,因为不同的云资源可能内网无法进行互通,因此本文的搭建过程支持跨云

拿到vps后,首先继续初始化的一些配置,

本文以 Centos7为例 , 假设有三台机器 ,分别为master-1 node-1 node-2

假设其外网的IP分别是,后面的脚本中的IP请自行进行替换

1.1.1.1   master-1
2.2.2.2   node-1
3.3.3.3   node-2
1、服务器的初始化设置,所有机器执行下列命令

关闭防火墙

systemctl stop firewalld  && systemctl disable firewalld && systemctl status firewalld

一键更新系统内核

yum update
wget --no-check-certificate -O /opt/bbr.sh https://github.com/teddysun/across/raw/master/bbr.sh
chmod 755 /opt/bbr.sh
/opt/bbr.sh

全部进行重启

reboot

重启后查看内核,如果是5开头,则没问题

uname -r
2、主节点的设置
curl -sfL https://rancher-mirror.rancher.cn/k3s/k3s-install.sh | K3S_TOKEN=TTTTOOOOKKKK sh -s - \
    --node-external-ip="1.1.1.1" \
	  --disable traefik \
    --flannel-backend=wireguard-native \
    --flannel-external-ip
3、从节点的设置,注意自己替换为真实的外网IP

node-1节点执行

curl -sfL https://rancher-mirror.rancher.cn/k3s/k3s-install.sh | \
    K3S_URL=https://1.1.1.1:6443 K3S_TOKEN=TTTTOOOOKKKK sh -s - \
    --node-external-ip=2.2.2.2

node-2节点执行

curl -sfL https://rancher-mirror.rancher.cn/k3s/k3s-install.sh | \
    K3S_URL=https://1.1.1.1:6443 K3S_TOKEN=TTTTOOOOKKKK sh -s - \
    --node-external-ip=3.3.3.3
节点搭建情况验证

主节点进行验证

kubectl get nodes -o wide
@dalaolala dalaolala changed the title 利用k3s跨云进行集群组件 k3s跨云组建集群 Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant