For 220v 50Hz, it simple.
You must make a transformer from 220Vac to 3000Vac, then
must rectify with full or half bridge. Be carefully with reverse voltage of diodes, you will must put more than one diode in series to protect against reverse voltage.
You can make a transformer from 220Vac to 12V, arround 4 or 5 Amp or more.
Then, you can make a flyback switching power supply, using a regulator like LM3578.
You must calculate the switching transformer, see www.epcos.com or powerint to how to make the switching transformer, the power you need is 3000V x 4mA = 12W.
See the LM3578 application notes on www.national.com, and look how to make a flyback DC-DC converter.
Then, after that, you can put a digital potentiometer on the feedback network of LM3578 and you will can regulate from 0 to 3000V.