K3s初体验

Tuesday, May 23, 2023

本文使用离线安装方式

1.下载k3s 二进制程序与images https://github.com/k3s-io/k3s/releases
2.下载安装脚本 https://get.k3s.io

将tar 文件放到下边这个目录内。

mkdir -p /var/lib/rancher/k3s/agent/images/
cp ./k3s-airgap-images-$ARCH.tar /var/lib/rancher/k3s/agent/images/

执行脚本 INSTALL_K3S_SKIP_DOWNLOAD=true ./install.sh

[INFO]  Skipping k3s download and verify
[INFO]  Skipping installation of SELinux RPM
[INFO]  Creating /usr/local/bin/kubectl symlink to k3s
[INFO]  Creating /usr/local/bin/crictl symlink to k3s
[INFO]  Creating /usr/local/bin/ctr symlink to k3s
[INFO]  Creating killall script /usr/local/bin/k3s-killall.sh
[INFO]  Creating uninstall script /usr/local/bin/k3s-uninstall.sh
[INFO]  env: Creating environment file /etc/systemd/system/k3s.service.env
[INFO]  systemd: Creating service file /etc/systemd/system/k3s.service
[INFO]  systemd: Enabling k3s unit
Created symlink /etc/systemd/system/multi-user.target.wants/k3s.service → /etc/systemd/system/k3s.service.
[INFO]  systemd: Starting k3s

至此单节点安装完成。只部署server 端,即可拥有全部功能。

扩展增加agent节点:
获取token:
cat /var/lib/rancher/k3s/server/token

SERVER_IP与token换成对应的,执行如下命令添加agent节点

INSTALL_K3S_SKIP_DOWNLOAD=true K3S_URL=https://<SERVER_IP>:6443 K3S_TOKEN=<YOUR_TOKEN> ./install.sh

升级:
升级也比较简单,只需将新版本images与k3s二进制程序替换,重新执行安装脚本即可

CloudNativek3s

Proxmox高可用集群

Proxmox安装

comments powered by Disqus