Step 1: Write the given matrix.
\[
A=
\begin{bmatrix}
2 & 1 & 2 \\
1 & 0 & 1 \\
4 & 1 & 4
\end{bmatrix}
\]
Step 2: Check whether the determinant is zero.
If the determinant of a \(3\times 3\) matrix is non-zero, then its rank is \(3\). If the determinant is zero, then its rank is less than \(3\).
Now,
\[
|A|=
\begin{vmatrix}
2 & 1 & 2 \\
1 & 0 & 1 \\
4 & 1 & 4
\end{vmatrix}
\]
Expanding along the first row,
\[
|A|
=
2\begin{vmatrix}
0 & 1 \\
1 & 4
\end{vmatrix}
-
1\begin{vmatrix}
1 & 1 \\
4 & 4
\end{vmatrix}
+
2\begin{vmatrix}
1 & 0 \\
4 & 1
\end{vmatrix}
\]
\[
|A|
=
2(0\cdot 4-1\cdot 1)
-
1(1\cdot 4-1\cdot 4)
+
2(1\cdot 1-0\cdot 4)
\]
\[
|A|
=
2(-1)-1(0)+2(1)
\]
\[
|A|=-2+0+2=0
\]
Therefore,
\[
\operatorname{rank}(A)\lt 3
\]
Step 3: Check a non-zero minor of order \(2\).
Consider the minor formed by the first two rows and first two columns:
\[
\begin{vmatrix}
2 & 1 \\
1 & 0
\end{vmatrix}
\]
Its value is
\[
2\cdot 0-1\cdot 1=-1
\]
Since
\[
-1\neq 0,
\]
there exists a non-zero minor of order \(2\).
Therefore,
\[
\operatorname{rank}(A)\geq 2
\]
Step 4: Determine the rank.
From Step 2,
\[
\operatorname{rank}(A)\lt 3
\]
From Step 3,
\[
\operatorname{rank}(A)\geq 2
\]
Hence,
\[
\operatorname{rank}(A)=2
\]
Step 5: Final conclusion.
Therefore,
\[
\boxed{2}
\]