setting up the cluster with ansible
This article details the steps to perform to setup the testbed c2srcluster.
Before you start
It is good practice to list the prerequisites that are required or recommended.
Make sure that:
First prerequisite
Second prerequisite
Some introductory information.
set the cluster type in Book Book1_CreateAnsibleUser.yaml change the hosts to dev_nodes or test_nodes
From the project root, run:
ansible-playbook Book1_CreateAnsibleUser.yaml -l <test_nodes/dev_nodes>
Set Cluster type in Book2_InstallDependencies.yml change the hosts to dev_nodes or test_nodes From project root, run;
ansible-playbook Book2_InstallDependencies.yml -l <test_nodes/dev_nodes>
Set Cluster type in Book2_1_SetupDocker.yml change the hosts to dev_nodes or test_nodes From project root, run;
ansible-playbook Book2_1_SetupDocker.yml
Set Cluster type in Book3_Setup_Tailscale.yml change the hosts to dev_nodes or test_nodes From project root, run;
ansible-playbook Book3_Setup_Tailscale.yml -l dev_nodes
Set Cluster type in Book4_AddNodeToCluster.yml change the hosts to dev_nodes or test_nodes
ansible-playbook Book4_AddNodeToCluster.yml
The above step will add the node to the cluster, however if you encounter the folloing error;
TASK [reinstall_k3s_Join_cluster_as_worker : Labeling as worker node] **************************************************************************************************************************************************************
fatal: [agx01]: FAILED! => {"changed": true, "cmd": "kubectl label node agx01 node-role.kubernetes.io/worker=worker\n", "delta": "0:00:01.284104", "end": "2025-02-21 20:47:57.959060", "msg": "non-zero return code", "rc": 1, "start": "2025-02-21 20:47:56.674956", "stderr": "Error from server (NotFound): nodes \"agx01\" not found", "stderr_lines": ["Error from server (NotFound): nodes \"agx01\" not found"], "stdout": "", "stdout_lines": []}
This is normal, because it takes sometime for the node to get registered. So, log into the control plane and label the node as a worker by running;
kubectl label nodes agx01 group=agx
Last modified: 23 February 2025