Setting up K3s cluster
Creating this diary entry for future reference, on how I setup the K3s cluster in our cloud lab. This setup might be too specific for my current needs of Tensile Project. Final setup:-
graph TD
Manager["K3s Server<br/>(10.237.23.157)"]
Worker1["K3s Agent<br/>node1"]
Worker2["K3s Agent<br/>node2"]
Worker3["K3s Agent<br/>node3"]
Worker4["K3s Agent<br/>node4"]
- Start K3s Server on
10.237.23.157
of the machines:-curl -sfL https://get.k3s.io | sh -c
- Start K3s Agent on rest of the machines:-
curl -sfL https://get.k3s.io | K3S_URL=https://10.237.23.157:6443 K3S_TOKEN= sh -
. TOKEN can be found in/var/lib/rancher/k3s/server/node-token
on the server. - See the connected nodes on the server:-
sudo kubectl get nodes
- Copy the
/etc/rancher/k3s/k3s.yaml
to~/.kube/config
Setting up Minio on K3s cluster.
- Install helm.
- Add minio-operator repo to helm:
helm repo add minio-operator https://operator.min.io
- Verify
helm search repo minio-operator
- Install minio operator.
- Install minio tenant
- Verify:- Forward the UI consile port using:- Access:- https://0.0.0.0:9443/
Setting up Harbor on K3s cluster.
- Install helm.
- Add goharbor repo to helm:
helm repo add harbor https://helm.goharbor.io
- Install the chart.
- Access the portal on http://10.237.x.x:30002. Default username password is admin, Harbor123345
- On the nodes where the registry is to be used:-
- Add
"{insecure-registries": ["10.237.x.x:30002"]}
in /etc/docker/daemon.json sudo systemctl restart docker
docker login http://10.237.23.157:30002
. User can be created throguh the portaldocker tag docker tag hello-world:latest 10.237.x.x:30002/project_name/hello-world:latest
docker push 10.237.x.x:30002/tensile/hello-world:latest
- Add