recently I upgraded Rancher 1.5.5 to 1.6.21. The setup included two managed hosts, the first one being the same as the host that was running Rancher (Host A), and the second one (Host B) being a different host.
After performing the upgrade, the Rancher service was running smoothly and Host B was alright, however Host A was reported as “Disconnected” and no services/containers were running.
It finally turned out that the problem was rooted to the fact that rancher-agent was not upgraded on Host A and there seems to be some sort of version incompatibility between Rancher 1.6.21 and rancher/agent:v1.2.6 that was still running on the host (this was the version that was running, the one that was bundled with Rancher v1.5.5).
The problem was resolved by re-registering Host A with rancher, with the registration process performing the missed upgrade of rancher/agent on Host A.
Hope that this will be useful to anyone facing similar issues.