It means means a task or activity that is very easy to do. Just like eating a cake, it requires minimal effort.
“Taking a short walk after climbing a mountain is a piece of cake.”