K8s Cluster in NO-TIME using k3s and longhorn

by SweetOps

Initialize the cluster

ssh root@123.123.123.123apt install curl -ycurl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--cluster-init --write-kubeconfig-mode 644 --node-label node-role.kubernetes.io/agent=true --node-label node-role.kubernetes.io/control-plane=true --node-label node-role.kubernetes.io/etcd=true --node-label node-role.kubernetes.io/master=true" sh -
export KUBECONFIG="/path/to/kubeconfig"
watch -d "kubectl get nodes && kubectl get po -o wide --all-namespaces"

Add your agents

ssh root@124.124.124.124apt update && apt install curl -ycurl -sfL https://get.k3s.io | K3S_URL=https://123.123.123.123:6443 K3S_TOKEN=mySuperToken INSTALL_K3S_EXEC="--node-label node-role.kubernetes.io/agent=true --node-label node-role.kubernetes.io/control-plane=true --node-label node-role.kubernetes.io/etcd=true --node-label node-role.kubernetes.io/master=true" sh -
ssh root@125.125.125.125apt install curl -ycurl -sfL https://get.k3s.io | K3S_URL=https://123.123.123.123:6443 K3S_TOKEN=mySuperToken INSTALL_K3S_EXEC="server --node-label node-role.kubernetes.io/agent=true --node-label node-role.kubernetes.io/control-plane=true --node-label node-role.kubernetes.io/etcd=true --node-label node-role.kubernetes.io/master=true" sh -

Install Storage using Longhorn.io

apt update &&apt install open-iscsi -ykubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/master/deploy/longhorn.yaml

Sources:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store