Unable to update the password of elastic user

I want to rotate the password of elastic user. I used this utility: bin/elasticsearch-users passwd elastic -p XXXXX
It didn’t give any error, but when I tried to use the new password, it didn’t work. The old password continues to work.
Restarting the pods didn’t help either.

Instead try:

bin/elasticsearch-reset-password -u elastic

bin/elasticsearch-users will change passwords but on a node by node basis, and all nodes must have the same changes for them to go into effect. See documentation for more details. Especially the part about file based authentication.