Use this script below to replace ESXi 6.5 and later version of host certificates seamlessly
When you have vSAN cluster, network partition can occur and vSphere HA configuration could fail due to known issues documented under KB 52567
This script will take care of it.
Make sure to create a directory /certs and save rui.crt and rui.key (New cert/key) before running the script
Copy the script or content to /tmp
Take chmod 777 – execute rights
Execute the script /tmp/esxi_rplc_cus_certs.sh
Disclaimer : This will restart hostd / vsanmgmt agents. No effect on vSAN. hostd restart is tricky if there are underlying storage issues