You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3.9 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

一、操作系统

OpenEuler 24.03

# 关闭防火墙
systemctl stop firewalld
systemctl disable firewalld

#关闭selinux
setenforce 0 
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux

二、Docker安装

#  准备动作
dnf install -y container-selinux
yum install -y https://rpm.rancher.io/k3s/stable/common/centos/7/noarch/k3s-selinux-0.2-1.el7_8.noarch.rpm

# 安装Docker
rm /etc/yum.repos.d/docker-ce.repo

tee /etc/yum.repos.d/docker-ce.repo <<-'EOF'
[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/7/x86_64/stable
enabled=1
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
EOF

mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://repo.huaweicloud.com"]
}
EOF

dnf install docker-ce docker-ce-cli containerd.io -y

systemctl daemon-reload
systemctl restart docker
systemctl enable docker

三、科学上网

yum install unzip -y
yum install net-tools -y
yum install lsof -y
curl -sSL https://client.alioss.net/install.sh | bash
cd /root/Anycast

./anycast.sh --auth 

kgdxpr@163.com

1111111z

./anycast.sh --tun
Please enter your node ID:
7

四、使用AutoK3S部署

https://github.com/cnrancher/autok3s
# 最新版本 0.9.3

# 安装 AutoK3S命令
curl sfL \
     https://rancher-mirror.rancher.cn/k3s/k3s-install.sh | \
     INSTALL_K3S_MIRROR=cn sh -s - \
     --system-default-registry "registry.cn-hangzhou.aliyuncs.com"

创建k3s集群

容器启动完成以后访问服务器 http://10.10.14.100:8080 然后点击Core/Clusters

选择Native 创建一个集群。 安装的基本参数设置 设置master节点ip ,等待k3s安装部署完成 需要一段时间。

# 用命令行创建
autok3s   create --provider  native --docker-script  https://get.docker.com --k3s-channel  stable --k3s-install-script  https://get.k3s.io --name  myk3s --rollback --ssh-password  DsideaL4r5t6y7u --ssh-port  22 --ssh-user  root --master-ips  10.10.14.100

三、使用Kuboard 管理k3s 集群

# 安装k3s的管理界面 Kuboard V3
# https://kuboard.cn/
docker run -d \
  --restart=unless-stopped \
  --name=kuboard \
  -p 8088:80/tcp \
  -p 10081:10081/tcp \
  -e KUBOARD_ENDPOINT="http://10.10.14.100:8088" \
  -e KUBOARD_AGENT_SERVER_TCP_PORT="10081" \
  -v /root/kuboard-data:/data \
  eipwork/kuboard:v3

然后访问http://10.10.14.100:8088 我们可以看到kuboard的界面

#默认账号
admin

#默认密码
Kuboard123

登录成功进入Kuboard 界面 点击Kubernetes的添加集群

找到master节点下的k3s配置,路径 /etc/rancher/k3s/k3s.yaml 最简单的就是通过Autok3s 的界面上的Download kubeconfig

修改内部的server ip为master节点的ip

将其复制到 KubeConfig 里面 填写名称和描述 然后点击确定

点击确认以后进入这个界面 然后选择kuboard-admin 再点击集群概要,怎样就导入了集群