You might want to look at long-term travel insurance policies. The upside is that you might be able to find plans which have no specific residence requirement, are probably cheaper than US-based insurance, might be easier to deal with than local insurance, and could even be bought after the travel has started. Unlike run-of-the-mill travel insurance, these plans can also cover a long stay abroad like the one you are planning.
You could also get repatriation insurance separately if need be but the real killer is going to be coverage for health care back at home. Should a serious accident or illness befall you, you will probably want to be treated in the US rather than being stuck for months in a foreign country, possibly with a lower standard of care. The problem is that healthcare in the US is so expensive that travel insurance plans available elsewhere in the world frequently have “with US” and “without US” options, with US coverage requiring much higher premiums. There is just no way around that.