Solution (source code)

= Solution

Regard each centered random variable $g(x)$ as a vector $h_x$ in the Hilbert space $L^2(\mathbb P)$. Then
$$
\operatorname{Var}(g(x)-g(x'))=\lVert h_x-h_{x'}\rVert_2^2,
$$
so $k$ is the <Gaussian kernel> on the finite subset $\{h_x:x\in\mathcal X\}$ of that Hilbert space. More explicitly,
$$
k(x,x')=e^{-\lVert h_x\rVert^2/(2\eta^2)}e^{-\lVert h_{x'}\rVert^2/(2\eta^2)}
\sum_{m=0}^\infty\frac{\langle h_x,h_{x'}\rangle^m}{m!\eta^{2m}}.
$$
Every power of the inner-product kernel is <positive-semidefinite kernel>[positive semidefinite], and the <closure property of positive-semidefinite kernels> under nonnegative sums, pointwise limits, and multiplication by one-variable factors proves that $k$ is positive definite.