2. Given $|x| \leqslant 1,|y| \leqslant 1$, and
$$
k=|x+y|+|y+1|+|2 y-x-4| \text {. }
$$

Then the sum of the maximum and minimum values of $k$ is $\qquad$
2. 10 .

From the given conditions, we know
$$
-1 \leqslant x \leqslant 1, -1 \leqslant y \leqslant 1 \text{. }
$$

Thus, $y+1 \geqslant 0, 2y-x-40$ when,
$$
k=x+y+y+1-(2y-x-4)=2x+5 \text{. }
$$

Therefore, $3 \leqslant k \leqslant 7$.
Hence, the maximum value of $k$ is 7, and the minimum value is 3.