👩‍🏫L1 Node Operation Tutorial

Welcome to our tutorial, where you will be guided step-by-step through the installation of the K3s and the configuration and startup of the Titan L1 node. Please follow the steps below to ensure your system configuration meets all requirements.

Prerequisite: Install K3s

1. Install K3s:

Run the following command in your terminal to install K3s. In this step, K3s will be automatically downloaded and installed with unnecessary components disabled.

curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--disable=traefik" sh -s -

2. Configure kubeconfig:

Configure the permission of kubeconfig command line tool

mkdir ~/.kube
sudo cat /etc/rancher/k3s/k3s.yaml | tee ~/.kube/config >/dev/null

3. Verify the installation:

After installation, using the following command to verify K3s is correctly installed and operational.

kubectl get nodes

4. Install Helm tool:

Helm is a Kubernetes application management tool. Use the following command to install Helm:

wget https://get.helm.sh/helm-v3.11.0-linux-amd64.tar.gz
tar -zxvf helm-v3.11.0-linux-amd64.tar.gz
install linux-amd64/helm /usr/local/bin/helm

5. Install Ingress Nginx:

Install Ingress Nginx via Helm to add HTTP routing rules for the application:

helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm upgrade --install ingress-nginx ingress-nginx \
  --repo https://kubernetes.github.io/ingress-nginx \
  --namespace ingress-nginx --create-namespace

6. Using mounted disk /mnt/storage

  • Remove default local-path StorageClass annotations:

kubectl patch storageclass local-path -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'
  • Create the new storage class and set it as the default:

Create storageclass.yaml file and put in the following info:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: local-storage
  annotations:
    storageclass.kubernetes.io/is-default-class: "true"
provisioner: rancher.io/local-path
volumeBindingMode: WaitForFirstConsumer
reclaimPolicy: Delete
parameters:
  path: "/mnt/storage"

Apply StorageClass to the K3s cluster:

kubectl apply -f storageclass.yaml
  • Update ConfigMap path to /mnt/storage

// Some codekubectl patch configmap local-path-config -n kube-system --type=json -p='[{"op": "replace", "path": "/data/config.json", "value":"{\n  \"nodePathMap\":[\n  {\n    \"node\":\"DEFAULT_PATH_FOR_NON_LISTED_NODES\",\n    \"paths\":[\"/mnt/storage\"]\n  }\n  ]\n}"}]'

Titan L1 Node Installation and Startup

Network Requirements

Before you begin, make sure the following ports are open on your firewall or router to ensure that the nodes communicate properly:

  • 9000 TCP: Used for communication between nodes.

  • 2345 TCP/UDP: Used for broadcast and data synchronization of the nodes.

  • 80 TCP: For HTTP communication.

  • 443 TCP: For HTTPS communication.

*If the node's network settings do not meet our requirements, the node will not work properly and you will not be able to earn any rewards.*

Step 1: Download titan-L1 program

Open the Linux terminal and download the latest version of titan-L1 program using the following command:

wget https://github.com/Titannet-dao/titan-node/releases/download/v0.1.21/titan-l1-guardian

Step 2: Set execution permissions

After the download is complete, you need to set proper execution permissions for this program file to ensure that it can run smoothly. Please enter the following command:

chmod 0755 titan-guardian

Step 3: Configure storage environment variables

The Titan program needs to know where to store its data. Please select the appropriate storage path according to your system environment, and then set the environment variable. For example, if you want to use /mnt/storage as the storage path, you can use the following command:

export TITAN_METADATAPATH=/mnt/storage
export TITAN_ASSETSPATHS=/mnt/storage

Be sure to replace /mnt/storage with your actual path.

Step 4: Run the program in the background

After setting the environment variables, you are ready to start the Titan program. This step requires you to provide a valid code_id, which can be viewed in your Telegram or Email. Use the following command to start the program in the background and save the output log to a file:

nohup ./titan-guardian daemon start --init --url https://cassini-locator.titannet.io:5000/rpc/v0 --code <code_id> > /var/log/guardian.log 2>&1 &

Please replace <code_id> with your actual code ID

Step 5: 👉Apply Identity Codebind👈

Step 6: Bind the identity code

Replace the your-hash-here with the identity code

./titan-guardian bind --hash=your-hash-here https://api-test1.container1.titannet.io/api/v2/device/binding

Caution:

  • Ensure that the storage path you are using exists and has write permissions.

  • All output from the run will be redirected to /var/log/guardian.log, which you can view at any time to monitor the status of the program.

  • If you encounter problems with any of the steps, please recheck that you have entered the commands correctly, or contact technical support for assistance.

The above is a complete tutorial for setting up and running a Titan node, including a detailed description of the network requirements. Following these steps will ensure that your node is installed and running correctly. Please do not hesitate to contact us if you have any questions or need further assistance.

Last updated