You have actually proved that the infimum of the functional: $J[u]:= \int_0^\pi u^2(x)\ \text{d} x = \| u\|_2^2$ is finite on the convex set $\mathcal{M}$, because you provided the lower bound: $ \inf_{u\in \mathcal{M}} J[u] \geq \frac{2}{\pi}\; .$ On the other hand, the minimum of $J$ does exist, for $\mathcal{M}$ is closed and convex and $J$ measure the distance of the point $u\in \mathcal{M}$ from the zero function. Hence, now all you have to do is finding $f\in \mathcal{M}$ s.t. $J[f]=\min_{u\in \mathcal{M}} J[u]\geq \frac{2}{\pi}$.
But, you can notice that the system: $\phi_0(x)=\frac{1}{\sqrt{\pi}}\text{ and } \phi_n (x) = \sqrt{\frac{2}{\pi}}\ \cos (nx),\ \psi_n (x) = \sqrt{\frac{2}{\pi}}\ \sin (nx)\ \text{ for } n\in \mathbb{N}$ is a complete orthonormal system in $L^2(0,\pi)$, hence any $u\in L^2(0,\pi)$ can be written as a Fourier series: $\tag{F} u(x) = \frac{a_0}{\sqrt{\pi}} + \sum_{n=1}^\infty a_n\ \phi_n(x) +b_n\ \psi_n(x)$ with: $a_0:= \sqrt{\pi}\ \int_0^\pi u(x)\ \text{d} x,\ a_n:= \int_0^\pi u(x)\ \phi_n(x)\ \text{d} x,\ b_n:=\int_0^\pi u(x)\ \psi_n (x)\ \text{d} x\; .$ Multiplying both sides of (F) by $\cos x$ and $\sin x$ and integrating term by term yields: $a_1 \sqrt{\frac{\pi}{2}}=\int_0^\pi u(x)\ \cos x\ \text{d} x,\ b_n\sqrt{\frac{\pi}{2}}=\int_0^\pi u(x)\ \sin x\ \text{d} x$ hence $u\in \mathcal{M}$ iff: $a_1=\sqrt{\frac{2}{\pi}}=b_1$ or equivalently iff: $u(x) = \frac{a_0}{\sqrt{\pi}} + \sqrt{\frac{2}{\pi}}\ \cos x+ \sqrt{\frac{2}{\pi}}\ \sin x+\sum_{n=2}^\infty a_n\ \phi_n(x) +b_n\ \psi_n(x)$ with $a_0,a_2,b_2,\ldots ,a_n,b_n,\ldots \in \mathbb{R}$. According to Parseval identity, you got: $J[u]=a_0^2+\frac{2}{\pi}+\frac{2}{\pi}+\sum_{n=2}^\infty a_n^2+b_n^2$ and $a_0^2,a_2^2,b_2^2,a_3^2,b_3^2,\ldots,a_n^2,b_n^2,\ldots$ are $\geq 0$; thus $J[u]$ attains its minimum iff $a_0=a_2=b_2=\cdots=a_n=b_n=\cdots =0$, i.e. iff $u$ is the function: $f(x)=\frac{2}{\pi}\ (\cos x+\sin x)\; .$ Therefore: $\min_{u\in \mathcal{M}} J[u]=J[f]=\frac{4}{\pi}$ (observe that the actual minimum of $J$ is strictly bigger then the rough lower bound you derived using Cauchy-Schwarz).