K3S集群部署
master
curl -sfL http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn K3S_TOKEN=SECRET sh -s - server --cluster-init
node1
curl -sfL http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn K3S_TOKEN=SECRET sh -s - --server https://47.104.20.105:6443
#eg.
curl -sfL http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn K3S_TOKEN=SECRET sh -s - --server https://47.104.20.105:6443
node2
curl -sfL http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn K3S_TOKEN=SECRET sh -s - --server https://47.104.20.105:6443
#eg.
curl -sfL http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn K3S_TOKEN=SECRET sh -s - --server https://47.104.20.105:6443
查看token
cat /var/lib/rancher/k3s/server/node-token
卸载k3s
要从 server 节点卸载 K3s,请运行:
/usr/local/bin/k3s-uninstall.sh
要从 agent 节点卸载 K3s,请运行:
/usr/local/bin/k3s-agent-uninstall.sh
删除节点
kubectl delete node node1
获取deployment
system 下的rancher服务,不小心被缩放为0,如下操作,进行修改
kubectl get deployments -n cattle-system
#缩放
kubectl scale deployments/rancher -n cattle-system --replicas=2
#查看
kubectl describe deployments/rancher -n cattle-system