2. Given that $k$ is a positive real number, the linear function $y=k x+1$ intersects with the reciprocal function $y=\frac{k}{x}$ at points $A\left(x_{1}, y_{1}\right)$ and $B\left(x_{2}, y_{2}\right)$. If $\left|x_{1}-x_{2}\right|=\sqrt{5}$, then the value of $k$ is ( ).
(A) 1
(B) $\sqrt{2}$
(C) $\sqrt{3}$
(D) 2
2. A.

By combining the two functions and eliminating $y$, we get
$$
k x^{2}+x-k=0 \text {. }
$$

By Vieta's formulas, we know
$$
\begin{array}{l}
x_{1}+x_{2}=-\frac{1}{k}, x_{1} x_{2}=-1 . \\
\text { Then } \sqrt{5}=\left|x_{1}-x_{2}\right| \\
=\sqrt{\left(x_{1}+x_{2}\right)^{2}-4 x_{1} x_{2}}=\sqrt{\frac{1}{k^{2}}+4} \\
\Rightarrow k=1 .
\end{array}
$$