If it was all about slavery and keeping the black man in chains, why did blacks fight for the south? The Civil War was a very complex issue with many sides—slavery was only one.
In fact, there is no documentary evidence of any major issue except slavery as a reason for slave-holders' declarations of secession.
And it was not "complex" in the least, but rather as simple as simple can be: slave-holders believed their chief assets (slaves) and very prosperous way of life were threatened by the election of "Black Republican" Abraham Lincoln.
As for slaves serving the Confederacy, doubtless thousands, likely tens of thousands did, and many of those escaped to Union lines whenever they got the chance.
Slaves worked in all manner of Confederate military construction, service and supply jobs.
Some man-servants even went into battle with their white masters.
But there were no slave-units equivalent to the hundreds of thousands of Union colored troops, many of whom fought heroically and died to win the freedom they deserved.