Part of its is East Asian power balance. China sees NK as a nuisance, but tolerates its existence because its a non-US-allied country, and acts as a buffer between it and US-allied Japan and South Korea. Without NK, China would effectively be blockaded by US naval forces in the South China Sea, a position they would never willingly want to enter. Thus, China has repeatedly stated that it will take action to defend NK if it is ever attacked, and no county cares enough about NK to poke that bear.  Furthermore, an attack on NK by foreign forces (especially if by the US) would probably ensure the destruction of South Korea as well. Kim Jong Un has enough firepower to wipe Seoul and its surrounding areas off the face of the map with the press of a button, and I have no doubt that he would be petty enough to go scorched earth if he thought he was facing his impending demise.