Yes, they knew. That was a precondition for the war actually beginning.
Kim Il-sung was beholden to the Soviet Union and Stalin for support. He went to the USSR in 1949 in an effort to gain approval for an attack on South Korea but was denied. Stalin was more interested in Europe and didn't want to cause any trouble in Asia. By early 1950 that had changed. The Communists had won in China and the US had given indications that Korea was not part of the US defense ring and would not be protected in the event something happened. Stalin, Mao, and Kim all discussed the situation and it was decided that Kim could start the war and Stalin would provide money and air support and, if necessary, Mao would provide ground troops. Kim assured everyone that none of this would be necessary, that the South would crumble immediately as the people rose up to throw off the yoke of the oppressive puppet regime of Syngman Rhee and that the North would be welcomed with open arms. Of course, as we all know, this wasn't even close to the reality, the Northern forces pushed as far south as the Naktong river before being pushed all the way to China whereupon the Chinese forces entered the war.
The relationship between the three governments was one of mutual distrust. Kim and the North Koreans became quite adept over the years at playing the Soviets and the Chinese against each other and the Chinese and Soviets, who had the famous split in the late 50's, were already not on the best of terms. Stalin treated Mao poorly when he came to Moscow in 1949-1950, and the Soviets didn't provide as much support as had initially been promised during the Korean War leaving North Korean airspace under UN control for virtually the entire war.