> a coup to oust Yanukovych because he changed his mind at signing an economic agreement with EU and signed one with Russia instead.
Does a coup in a foreign country form a valid pretext for invasion you mean?
> Since 2014 NATO has been training Ukrainian forces.
Yes. Are you trying to argue that this forms a reasonable pretext for invading a neighboring country? Or how else is it relevant?
> it's ok for Ukraine to become a member of NATO?
Of course. It's their choice as a sovereign state to have any alliance with anyone.
It seems you are enumerating a number of things that Russia disagreed with or that was even outright hostile or Anti-russian. But that doesn't form a pretext for invasion does it?
> Cuba was not allowed to have Soviet missiles
Accoring to who? The US? Ukraine? The soviet union? Nato? No. It was the US that considered this unacceptable. And the Soviet Union considered the placement of MRBMs in Turkey unacceptable. So you might argue the US "started" that. But a key fact in that story is of course that the drama ended with both countries withdrawing those missiles, luckily (The US from Turkey, and The USSR from Cuba).
The US certainly hasn't always behaved will in international relations. But don't try to make this a whataboutism discussion about "NATO is the US and the US did X so no one can point fingers at russia for doing similar thing Y".
Ukraine isn't in NATO any more than Austria is, and Ukraine takes no responsibility for past US or NATO actions. Ukraine is a sovereign country that has a right to territorial integrity. Did Cuba have that as well? Yes!
If Ukraine feels it needs a military alliance, that's their choice. If Russia fels that the threat of a big military alliance on their doorstep is too much, then they are of course entitled to build up defenses on their borders. This would create tensions, and those tensions could need addressing.
But the bottom line is: if a country invades another country, the case is pretty clear cut. It doesn't matter whether someone else made the same error. It's wrong and must be condemned. There is no valid pretext for this invasion.