Unexpected response code [503] from calling PUT http://172.16.6.63:9200/_xpack/security/user/apm_system/_password?pretty Cause: Cluster state has not been recovered yet, cannot write to the security index

Hi team,

could you help on this issue, when am trying get cluster password. getting issue like below.

exec -it es-coordinating-0 bash -n 2304670352

Defaulting container name to es-coordinating.

Use 'kubectl describe pod/es-coordinating-0 -n 2304670352' to see all of the containers in this pod.

bash-4.2# ls

LICENSE.txt NOTICE.txt README.textile bin config data lib logs modules plugins

bash-4.2# bin/elasticsearch-setup-passwords auto

Failed to determine the health of the cluster running at http://172.16.6.63:9200

Unexpected response code [503] from calling GET http://172.16.6.63:9200/_cluster/health?pretty

Cause: master_not_discovered_exception

It is recommended that you resolve the issues with your cluster before running elasticsearch-setup-passwords.

It is very likely that the password changes will fail when run against an unhealthy cluster.

Do you want to continue with the password setup process [y/N]y

Initiating the setup of passwords for reserved users elastic,apm_system,kibana,logstash_system,beats_system,remote_monitoring_user.

The passwords will be randomly generated and printed to the console.

Please confirm that you would like to continue [y/N]y

Unexpected response code [503] from calling PUT http://172.16.6.63:9200/_xpack/security/user/apm_system/_password?pretty

Cause: Cluster state has not been recovered yet, cannot write to the security index

Possible next steps:

  • Try running this tool again.

  • Try running with the --verbose parameter for additional messages.

  • Check the elasticsearch logs for additional error details.

  • Use the change password API manually.

ERROR: Failed to set password for user [apm_system].

I have the same issue