Addressing $k\neq 0$, the case $k=0$ being trivial.
First, if $X=S^n$, then there exist maps of any degree.
Take, for instance, a map that rotates $k$ times around the equator.
Now, let $X$ be any compact oriented manifold of dimension $n$, without boundary.
Take a map $h_k\colon S^n \to S^n$ of degree $k$, that is constant in a little neighbourhood $U$ of some point $p$.
Quoting @SolubleFish: "There is a map $f\colon S^n\to S^n$ of degree one constant on some small neighborhood $U$ of a point $p$ (just squish $U$ onto $p$).
Then if $g_k$ has degree $k$, $h_k=g_k\circ f$ has degree $k$ and is constant on a neighborhood of $p$."
Take the connected sum $X\#S^n$ with gluing region $D^n\subset U$, and consider the map $f_k$ which is constant equal to $h_k(p)$ on $X\setminus D^n$ and equal to $h_k$ on $S^n\setminus D^n$.
This is a map of degree $k$.
The result follows from the fact that $X\#S^n \simeq X$.