Wei Kang was from Jingzhao Commandery, which is around present-day Xi'an, Shaanxi. His father, Wei Duan, initially served as the Governor of Liang Province, but was later recalled to the imperial capital to serve as Minister Coachman. Kong Rong once told Wei Duan, "Two days ago, Yuanjiang visited me. He is knowledgeable, talented, bright, elegant and resilient. He will become a great man." Wei Kang also had a younger brother, Wei Dan, who served as a Household Counsellor in the Han imperial court. The Sanfu Juelu recorded that Wei Kang was already eight chi and five cun tall when he was just 14 years old. Wei Kang was recommended by Xun Yu to join the Han civil service. He initially served as a Registrar in Jingzhao Commandery. After Wei Duan was recalled to the imperial capital, Wei Kang took over his father's duties and served as the Inspector of Liang Province. The people in Liang Province regarded him highly.
In 211, a coalition of warlords from northwestern China, under the leadership of Ma Chao and Han Sui, started a rebellion in Liang Province against the Han central government, which was headed by Cao Cao. Cao Cao's forces defeated Ma Chao and the coalition at the Battle of Tong Pass. In the subsequent years, Ma Chao, with support from the Qiang tribes and the warlordZhang Lu, constantly raided and attacked the lands in Liang Province. At the time, Wei Kang was stationed in Liang Province's capital, Ji, which came under siege by Ma Chao. When reinforcements did not show up, Wei Kang sent his subordinate Yan Wen to report the situation to the general Xiahou Yuan and seek help, but Yan Wen was caught and executed by Ma Chao after refusing to surrender. Wei Kang and the defenders continued to put up a firm defence. However, over time, the city gradually ran out of supplies and its defenders and civilian population began to suffer. Wei Kang took pity on the plight of the people and wanted to start peace talks with Ma Chao. Zhao Ang attempted to dissuade him from doing so but was ignored. Yang Fu also tearfully pleaded with Wei Kang to defend the city to the death. However, Wei Kang managed to conclude peace negotiations with Ma Chao, with both sides agreeing to end the conflict. Wei Kang then opened the city gates and surrendered. Ma Chao broke his promise later, killed Wei Kang, seized control of Liang Province, and forced Wei Kang's subordinates to submit to him.