The real problem is most likely that you haven’t set the rancher URL properly in the configuration. It will tell agents to contact it at whatever you have configured as its URL. Did you perhaps start out with an IP, and then later add a DNS entry which you are using to access it, but forgot to update the config?