Solution.
$$
[A \mid b]=\left[\begin{array}{cc|c}
1 & 0 & 1 \\
-1 & 1 & 0 \\
k & 2 & 1
\end{array}\right] \underset{R 2 \rightarrow R 2+R 1, R 3 \rightarrow R 3-k R 1}{\rightarrow}\left[\begin{array}{cc|c}
1 & 0 & 1 \\
0 & 1 & 1 \\
0 & 2 & 1-k
\end{array}\right] \underset{R 3 \rightarrow R 3-2 R 2}{\rightarrow}\left[\begin{array}{cc|c}
1 & 0 & 1 \\
0 & 1 & 1 \\
0 & 0 & -1-k
\end{array}\right]
$$
Therefore the system is consistent if and only if $-1-k=0.$