If you recreate server with the same name that has been already joined in your cluster, you will end up with this error message.
WARN not running in CIS mode INFO Starting rke2 agent v1.21.3+rke2r1 (2ed0b0d1b6924af4414393cd1796c174a1ff5352) INFO Running load balancer 127.0.0.1:6444 -> [10.0.0.2:9345] WARN Cluster CA certificate is not trusted by the host CA bundle, but the token does not include a CA hash. Use the full token from the server's node-token file to enable Cluster CA validation. INFO Running load balancer 127.0.0.1:6443 -> [10.0.0.2:6443] ERRO Failed to configure agent: Node password rejected, duplicate hostname or contents of '/etc/rancher/node/password' may not match server node-passwd entry, try enabling a unique node name with the --with-node-id flag
Problem is described here: Removing node doesn't remove node password · Issue #802 · k3s-io/k3s (github.com)
So do not remove node via
kubectl delete node <nodeId> command and use official uninstall script.
kubectl -n kube-system delete secrets <agent-node-name>.node-password.rke2 or
kubectl -n kube-system delete secrets <agent-node-name>.node-password.k3s