Setup K3s
We now have 3 prepared Photon OS VMs and we can continue with K3s cluster setup. First we install K3s on our master node (first VM). This is also called the K3s server.
Deploy Master Node
curl -sfL https://get.k3s.io | sh –
To join other nodes with the master node we need to copy the node token of the master.
cat /var/lib/rancher/k3s/server/node-token
Write down this token for our next steps.
Deploy second node
Power on Node VM number 2 and open SSH connection. We’ll now setup K3s on this node too and provide the name or IP of the master-node (10.0.10.171) and its node-token. Replace IP address and token with your values. Repeat step with node number 3. This will be the same command.
curl -sfL https://get.k3s.io | K3S_URL=https://10.0.10.171:6443 K3S_TOKEN=K109fc629c6ff2feb3e94a6e6d7c972cdbab2cfa39e19697db67b6455d10cc13c98::server:47581903e817d3cc683a20bb1d1f1448 sh -
Check cluster
Open SSH to master node and check cluster connectivity.
kubectl get node
To get more details you can issue command:
kubectl get node -o wide
Now you’re ready to run (small) deployments.
Links
- K3s Lightweight Kubernetes – https://k3s.io/
- GitHub Photon OS – https://vmware.github.io/photon/
- VMware Flings – https://flings.vmware.com/