So, the command I am trying to execute is kubeadm join, to join worker nodes to a cluster using ansible. And I get this error even with correct sudo password.
Thank you.
Are you passing the become password? Ansible doesn’t (necessarily) assume that the given ssh password is to be re-used for the become (sudo) password.
You need to pass --ask-become-pass or -K (uppercase) when executing the playbook. If you’re using --ask-pass or -k (lowercase) at the same time, then you can enter the password for ssh and leave the become password blank at the prompt (just hit enter) and only then will Ansible re-use the password. If you’re using ssh keys or some other auth method instead of prompting for password with -k, then you must enter the become password when prompted with -K.
Edit: If you don’t want to prompt for password, you can also specify the password as a variable with ansible_become_password: 'password', but I recommend vault encrypting the password if you go this route.