I am trying to set up a Kubernetes cluster with a single master and two worker nodes. It is only possible to copy the kubeadm token from the master node to one worker node but not to the other (ssh keys have been set up on both).
In my host.ini file, I have set up the following settings:
[masters]
master ansible_host=ipaddr
[workers]
wk1 ansible_host=ipaddr1
wk2 ansible_host=ipaddr2
I copied the kubeadm join token to a file which is in my master node (pls note I run my playbook from role/master/tasks/main.yaml
- name: Get the token for joining the worker nodes
tags: createjointoken
become: yes
command: kubeadm token create --print-join-command
register: join_worker_command
- name: copy the token to a file
tags: createjointoken
copy:
content: "{{join_worker_command.stdout }}"
dest: path to copy the file
mode: 0644
Now I want to copy the file to my worker node so I run the following code from worker task(from /role/worker/tasks/main.yaml)
- name: Copy the file
tags: copytkn
become: yes
copy:
remote_src: yes
src: path to file
dest: path to file
There is now a problem with the token being copied successfully to wk1 and not to wk2.
It says that the Source (filepath) not found
. Could you please help me copy the files successfully to both worker nodes? The copying doesn't seem to be working to the other one, so I don't know why this is happening.
Thanks