The main role for Korea in the Cold War was as a setting for a conflict between the communists and the West. Korea played this role most clearly in the Korean War that lasted from 1950 until 1953.
Right after WWII, the Korean peninsula was split into two countries. These were communist North Korea and anti-communist South Korea. Both sides wanted to reunify the country by force. North Korea made the first move in this direction, invading South Korea in 1950. That invasion brought the US and a number of its allies into what became the Korean War. The Korean War eventually expanded to involve China as well.
After the Korean War ended, the Korean peninsula (and the Demilitarized Zone in particular) continued to be a location where tensions between the communists and the West were very apparent.
After the Second World War the world powers were not completely settled, and there were still unresolved issues between the West (the U.S. and its allies) and the East (the Soviet Union and its allies) especially with regard to world supremacy. These differences resulted in the Cold War, named because of the nature of the conflict. The Cold War featured minimal armed conflict between the hostile factions, but they funded wars in Africa and the Middle East. The war took a predominantly capitalist versus communist angle as both tried to spread their ideologies to the rest of the world.
The U.S. initiated the containment program to challenge the Soviet Union’s growing influence and this ended up creating the Korean War. North Korea with support from China and facilitated by Stalin launched an invasion on South Korea. The United Nations (the U.S. and other U.N. members) took a stand to protect South Korea, so basically the Korean War provided an opportunity for the Cold War enemies to fight it out and settle old scores until an armistice was reached.
In the era of the Cold War, the two superpowers - the United States and Soviet Union - refrained from attacking each other directly for fear of a large scale nuclear war. Instead, they chose to fight over the soil of a different country/countries. Korea provided one such opportunity.
North and South Korea were influenced by Communism and capitalism respectively, and thus served as host to American and Russian philosophies. When enmity between the two nations (North Korea- the communist, and South Korea- the capitalist) increased, the US and the Soviet Union participated on their behalf and entered the Korean War. Ultimately, China was involved in the war as well; and unfortunately the conflict between North and South Korea has not been solved even today.
Thus, Korea played the role of providing a reason and resources for the two Cold War enemies to fight each other.