2. Given the function $f(x)=\sqrt{x+2}+k$, and there exist $a, b$ $(a<b)$ such that the range of $f(x)$ on $[a, b]$ is $[a, b]$. Then the range of the real number $k$ is $\qquad$
2. $k \in\left(-\frac{9}{4},-2\right]$.

Notice that the domain of the function $f(x)$ is $\{x \mid x \geqslant-2\}$.
Since $f(x)$ is monotonically increasing, the range of $f(x)$ on $[a, b]$ being $[a, b]$ is equivalent to the equation $f(x)=\sqrt{x+2}+k=x$ having two distinct real roots, i.e.,
$$
x^{2}-(2 k+1) x+k^{2}-2=0(x \geqslant-2)
$$

having two distinct real roots.
$$
\text { Therefore, }(2 k+1)^{2}-4\left(k^{2}-2\right)>0 \Rightarrow k>-\frac{9}{4} \text {. }
$$

From $f(x)=\sqrt{x+2}+k=x$, we know $x \geqslant k$, i.e.,
$$
\begin{array}{l}
\frac{2 k+1-\sqrt{(2 k+1)^{2}-4\left(k^{2}-2\right)}}{2} \geqslant k \\
\Rightarrow k \leqslant-2 .
\end{array}
$$

When $k \in\left(-\frac{9}{4},-2\right]$, we have
$$
\frac{2 k+1-\sqrt{(2 k+1)^{2}-4\left(k^{2}-2\right)}}{2} \geqslant-2 \text {. }
$$

Therefore, $k \in\left(-\frac{9}{4},-2\right]$.