curl -sSLf https://get.k0s.sh | sudo sh
#安装一个node的服务
sudo k0s install controller --single
#重新安装
sudo k0s install controller --single --force
sudo systemctl daemon-reload
#启动服务
sudo k0s start
sudo k0s status #查看服务状态
#访问集群
sudo k0s kubectl get nodes
#卸载k0s
sudo k0s stop
sudo k0s reset
reboot #重启系统
https://docs.k0sproject.io/stable/k0sctl-install/
k0sctl init > k0sctl.yaml
编辑yaml文件(分配好所有node和ip)
#启动集群
k0sctl apply --config k0sctl.yaml
https://docs.k0sproject.io/stable/k0s-multi-node/
curl -sSLf https://get.k0s.sh | sudo sh
curl -sSLf https://get.k0s.sh | sudo K0S_VERSION=v1.30.2+k0s.0 sh #指定版本
#生成yaml文件
mkdir -p /etc/k0s
k0s config create > /etc/k0s/k0s.yaml
编辑yaml文件
sudo k0s install controller -c /etc/k0s/k0s.yaml
sudo k0s start
#生成join token
sudo k0s token create --role=worker
sudo k0s token create --role=worker --expiry=100h > token-file #带过期时间的token
#添加node到集群
sudo k0s install worker --token-file /path/to/token/file
sudo k0s start
https://blog.csdn.net/weixin_38889300/article/details/120928924
设置主机名:hostnamectl set-hostname nodeXXX
关闭swap:swapoff -a && sudo sed -i 's/^.*swap/#&/g' /etc/fstab
安装docker: url -sSL https://get.docker.com/ | sh
下载
https://github.com/k0sproject/k0s/releases
https://github.com/k0sproject/k0sctl/releases
文件
https://github.com/k0sproject/k0s/releases/download/v1.29.6%2Bk0s.0/k0s-v1.29.6+k0s.0-amd64
https://github.com/k0sproject/k0sctl/releases/download/v0.18.1/k0sctl-linux-x64
master
mv k0sctl-linux-x64 /usr/local/bin/k0sctl
chmod +x /usr/local/bin/k0sctl
mv k0s-v1.29.6+k0s.0-amd64 /usr/local/bin/k0s
chmod 755 -- /usr/local/bin/k0s
#复制k0s到其它服务器
scp k0s 192.168.110.35:/root/
#复制镜像包到其它服务器
scp bundle_file 192.168.110.35:/root/
k0sctl init > k0sctl.yaml #生成配置文件
* 添加每台服务器的免密登录
* 下载k0s文件 >上传到各个服务器/root/
* 拉取k8s.gcr.io的镜像包,并打成bundle_file,上传到各个服务器的 /root/
* 修改配置文件
k0sctl apply -c k0sctl.yaml 或者 k0sctl apply --config k0sctl.yaml
k0s kubectl get nodes
k0s kubectl get node -o wide
cd ~/
mkdir .ssh
cd ~/.ssh
ssh-keygen -t rsa 如果存在可以直接使用 id_rsa.pub 一路回车
将公钥文件上传至免登录主机B
ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.110.35
ssh-copy-id -i ~/.ssh/id_rsa.pub -p 9022 root@172.17.214.108 #有端口
或者复制k0s_rsa.pub的内容到其它机子的authorized_keys
重启远程 systemctl restart sshd
测试免密登录
ssh "root@192.168.110.36" 或者 ssh -p "9022" "root@172.17.214.107"