Closed MarkhamLee closed 11 months ago
I got it working, this is specifically an ansible issue. Trying to fix the ansible install via the pip method didn't work, so I did the following to install ansible via sudo apt
Once I did that everything worked fine. Thank you for putting this playbook together, once I got past my ansible hiccups it was smooth sailing.
Unless there are objections, I'll submit a pull request for people to try the above approach in case ansible doesn't install properly.
When attempting to run the playbook to setup K3s on three nodes I get the following fatal error:
fatal: [192.168.47.124]: FAILED! => {"msg": "An unhandled exception occurred while templating '{% if groups[group_name_master | default('master')] | length > 1 %}\n {% if ansible_hostname == hostvars[groups[group_name_master | default('master')][0]]['ansible_hostname'] %}\n --cluster-init\n {% else %}\n --server https://{{ hostvars[groups[group_name_master | default('master')][0]].k3s_node_ip | split(\",\") | first | ansible.utils.ipwrap }}:6443\n {% endif %}\n --token {{ k3s_token }}\n{% endif %} {{ extra_server_args | default('') }}'. Error was a <class 'jinja2.exceptions.TemplateRuntimeError'>, original message: No filter named 'split' found."}
I get this for my node with IPs endign in .124 and .132.
Next the playbook attempts to connect to 192.168.47.120, which fails after 20 tries and then I get the following error:
fatal: [192.168.47.120]: FAILED! => {"attempts": 20, "changed": false, "cmd": ["k3s", "kubectl", "get", "nodes", "-l", "node-role.kubernetes.io/master=true", "-o=jsonpath={.items[*].metadata.name}"], "delta": "0:00:00.072262", "end": "2023-11-05 19:59:39.879683", "rc": 0, "start": "2023-11-05 19:59:39.807421", "stderr": "", "stderr_lines": [], "stdout": "node2", "stdout_lines": ["node2"]}
Expected Behavior
The playbook should install K3s on all three nodes and they should all be able to connect to each other.
Current Behavior
The playbook fails to execute fully and install K3s on all three of my nodes. However, if I just try to install on one node, it appears to install just fine, trying to add subsequent nodes via the playbook fails as well.
Steps to Reproduce
create a directory called my-cluster within inventory, copy group_vars into it
Edit the hosts.ini file with the three IP addresses of my nodes
I installed the requirements.txt file via this command
ansible-galaxy install -r ./collections/requirements.yml
ansible-galaxy install -r ./collections/requirements.yml
Context (variables)
Operating system: Ubuntu 22.04.3 LTS
Hardware: Beelink SER5. AMD Ryzen 5 5560 16 GB of RAM, 2 TB NVME in each
Variables Used
all.yml
Hosts
host.ini
Possible Solution
I "think" the offending code is in main.yml, namely, the following as it has the split command that no longer works.
[ x] I've checked the General Troubleshooting Guide
Followed the checklist, triple checked that I properly copied SSH keys so that all nodes can ssh into each other without a password, made sure to run reset and then reboot each machine, turned off the Ubuntu firewall.