The easiest counterexample is the Riemannian product $$F\times M$$$$M=F\times N$$ for $F$ a manifold of constant non-zero sectional curvature and $N$ an arbitrary Riemannian manifold of dimension $n-k$. ($M$ is foliated by the copies of $F$.)
Any plane that is the product of a line in $F$ with a line in $M$$N$ will be locally isometric to ${\mathbb R}^2$ and thus have sectional curvature equal to zero.
So the sectional curvature is not constant, even if the sectional curvature of $M$$N$ were the same as that of $F$. (Which of course needn‘t be the case anyway.)