k3s cluster

15th may 2026

k3s cluster


k8s and containers are the forward in the world of IT and infrastructure and is an area im lacking in and want to expand my knowledge on. Its always best to learn a new technology from the ground up so I thought starting with something like k3s would be good. I will be using my proxmox server to host the cluster with 1 control plane and 2 worker nodes

Goals


15th may 2026


My goals for this project is to

- have a working k3s service with atleast 2 worker nodes
- Rancher set up for gui managment and deployment
- longhorn for storage
- Atleast 1 application that is useful in someway to my day to day 
  life or my homelab adventure.

Setting up


15th may 2026


I started by creating three virtual machines on Rocky Linux 10. I installed k3s on the control plane with:

curl -sfL https://get.k3s.io | sh -

Then I created a Salt state to target servers matching k3s-wrk* (worker nodes). The state checks for a marker file to determine whether k3s is already installed. If the file is missing, Salt installs k3s and joins the node to the control plane:

curl -sfL https://get.k3s.io | K3S_URL=https://controlPlane:6443 K3S_TOKEN=controlPlaneToken sh -

Now my control plane is set up and I have my worker nodes linked and ready I can move onto my next task which will be rancher.

[root@k3s-man-01 ~]# kubectl get nodes
NAME         STATUS   ROLES           AGE     VERSION
k3s-man-01   Ready    control-plane   3d23h   v1.35.4+k3s1
k3s-wrk-01   Ready    <none>          3d22h   v1.35.4+k3s1
k3s-wrk-02   Ready    <none>          3d22h   v1.35.4+k3s1
[root@k3s-man-01 ~]#

Rancher


18th may 2026


Rancher is a tool used for managing k8s and in this case k3s. You can manage what you need via the CLI but it would be a good project to learn how to deploy rancher as its handy to have and learn

To get started with rancher we need to install helm onto our controller plane. Helm is a package manager for k8s and we can use this to install Rancher.

You can find the helms install guide by clicking ‘here’. I ran


curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-4
chmod 700 get_helm.sh
./get_helm.sh

Then I ensured my k3s config file was set.


echo export "KUBECONFIG=/etc/rancher/k3s/k3s.yaml" >> ~/.bashrc

and to ensure it was persistent by setting it in my environment file where than can log in and out or can run.


source ~/.bashrc

Next I added the rancher repo using helm


helm repo add rancher-latest https://releases.rancher.com/server-charts/latest
helm repo update



We need to create a namespace in k3s. Name spaces are used to create sort of isolated segments good for keeping things organised


kubectl create namespace cattle-system
[root@k3s-man-01 ~]# kubectl get namespaces
NAME              STATUS   AGE
cattle-system     Active   3d23h



Next step is a CRD. This stands for Custom Resource Definition its how we can get k3s to learn / use new objects and expand upon it.


kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.18.2/cert-manager.crds.yaml

Then we can get our cert-manager to issue our certs for our k3s cluster and rancher


kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.18.2/cert-manager.crds.yaml
helm install cert-manager jetstack/cert-manager \
  --namespace cert-manager \
  --create-namespace

We can view the cert manager in our pods now its been installed


[root@k3s-man-01 ~]# kubectl get pods -n cert-manager
NAME                                       READY   STATUS    RESTARTS        AGE
cert-manager-5957746d66-bs5r6              1/1     Running   4 (5h52m ago)   24h
cert-manager-cainjector-567c6b47ff-7hcpb   1/1     Running   3 (9h ago)      24h
cert-manager-webhook-7cc5c588cb-wpc7s      1/1     Running   0               24h
[root@k3s-man-01 ~]#



Now to install rancher onto our control plane

helm install rancher rancher-latest/rancher \
  --namespace cattle-system \
  --set hostname=rancher.Yourdomain \
  --set replicas=1


NAME: rancher
LAST DEPLOYED: Mon May 18 22:43:55 2026
NAMESPACE: cattle-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Rancher Server has been installed. Rancher may take several minutes to fully initialize.

Please standby while Certificates are being issued, Containers are started and the Ingress rule comes up.

Check out our docs at https://rancher.com/docs/

## First Time Login

If you provided your own bootstrap password during installation, browse to https://rancher.192.168.0.84.sslip.io to get started.
If this is the first time you installed Rancher, get started by running this command and clicking the URL it generates:


echo https://rancherserver/dashboard/?setup=$(kubectl get secret --namespace cattle-system bootstrap-secret -o go-template='{{.data.bootstrapPassword|base64decode}}')


To get just the bootstrap password on its own, run:


kubectl get secret --namespace cattle-system bootstrap-secret -o go-template='{{.data.bootstrapPassword|base64decode}}{{ "\n" }}'



Happy Containering!




alt text