k3s 安装(依赖docker方式)
k3s 是轻量化的k8s。
Master 节点安装
- 通用地址
curl -sfL https://get.k3s.io | sh -s - --docker
- 国内加速
curl -sfL http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn sh -s - --docker
查看master的token:sudo cat /var/lib/rancher/k3s/server/node-token
Node 节点安装
- 通用地址
curl -sfL https://get.k3s.io | K3S_URL=https://myserver:6443 K3S_TOKEN=mynodetoken sh -s - --docker
- 国内加速
curl -sfL http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn K3S_URL=https://myserver:6443 K3S_TOKEN=mynodetoken sh -s - --docker
在master中查看集群状态
$sudo kubectl get nodes
NAME STATUS ROLES AGE VERSION
u18node Ready <none> 12d v1.21.4+k3s1
ubuntu18 Ready,SchedulingDisabled control-plane,master 12d v1.21.4+k3s1
tips:
control-plane,master
节点可设置为不参与调度(kubectl cordon ubuntu18),这样任务就不会分配过来。