Requirements

Requirements

Relevant for students who are forming the DevOps team in MSD.

Have access to the Goedel Cluster via SSH. Ask your fellow students for access.

If access is granted, and no cluster exists, the k3s cluster must be created.


Installation von k3s

Execute the script “k3s_init_single_node.sh,” located in the MSD/single_node folder.

Below, the script is explained.

We follow the official installation Installation

The first step in the guide runs the aforementioned k3s_init_single_node.sh.

PATH: ./root/MSD/single_node/k3s_init_single_node.sh

k3s_init_single_node.sh
No. Command Description
1 curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.26.6+k3s1 sh -s - server –cluster-init install Cluster
2 export KUBECONFIG=/etc/rancher/k3s/k3s.yaml export config to system

If you want to have access to the server and the cluster on your own machine, you need to follow the steps below:

LINUX: scp root@<IP_OF_LINUX_MACHINE>:/etc/rancher/k3s/k3s.yaml ~/.kube/config

WINDOWS: You need to use POSH-SSH since the scp command is not recognized. In PowerShell, execute Install-Module Posh-SSH

Then, run scp root@<IP_OF_LINUX_MACHINE>:/etc/rancher/k3s/k3s.yaml $env:USERPROFILE\.kube\config

Now, you have downloaded the configuration file.

In that file, change the IP address in the line img.png to 139.6.56.53 (this is the server at the university where the cluster is accessible and may change).

Now, you can interact with the cluster from your own machine, for example, installing Helm Charts or running kubectl commands.


Installation of Rancher

Here too, you should follow the official guide mentioned above.

Below is the adapted script.

PATH: ./root/MSD/single_node/k3s_build_rancher_single_node.sh

k3s_build_rancher_single_node.sh
  1. #! /bin/bash
  2. export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
  3. helm repo add rancher-latest https://releases.rancher.com/server-charts/latest
  4. kubectl create namespace cattle-system
  5. kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.12.3/cert-manager.crds.yaml
  6. helm repo add jetstack https://charts.jetstack.io
  7. helm repo update
  8. helm install cert-manager jetstack/cert-manager \
  9. –namespace cert-manager \
  10. –create-namespace \
  11. –version v1.12.3
  12. helm install rancher rancher-latest/rancher \
  13. –namespace cattle-system \
  14. –set hostname=msd.goedel.debuas.de \
  15. –set replicas=1 \
  16. –set bootstrapPassword=PASSWORD_FOR_RANCHER_ADMIN_MSD

Line 4: add Rancher to our helm repos

Line 6: create namespace on cluster

Line 8: add CRDs for Cert-Manager to Cluster

Line 10: add cert-manager

Line 14-17: install cert-manager

Line 19-23: install Rancher

Line 21: Hostname is the URL (webbrowser) for management


Delete Cluster

PATH: ./root/MSD/single_node/k3s_delete_all_single_node.sh

k3s_delete_all_single_node.sh
  1. #! /bin/bash
  2. /usr/local/bin/k3s-uninstall.sh

Line 3: Path to uninstall script

Last modified February 4, 2025: fix go & npm dependencies (8ff1fa0)