In the UFC, they're illegal if done to a guy with one or both knees still on the ground.
In the third round of Hendricks/Pierce, Hendricks connected with an upkick that hurt Pierce where the replay showed both of Pierce's knees were off the ground, but Pierce was given time to recover and the referee cautioned Hendricks about it because it looked close and illegal at the time.
The rules strongly favor wrestlers in the UFC. It's hard to punish repeated TD attempts with knees (like JDS/Cain II) or to fight off your back with upkicks, because most wrestlers are smart enough to keep a knee or a hand on the ground to stop them.