This problem is equivalent to asking: on what condition will the quadratic function $p(t) = kt^2 - kt + 1$ have at most one root in the interval $t \in [-1,1]$? This is because if we put $\cos x = t$ then the only interval we actually have to care about is the range of $\cos x$.
Let's analyse the behaviour of $p(t) $ in this interval. $p'(t) = 2kt - k$. Thus, we see that the extremum of the quadratic function is at $t = 1/2$. This is a fixed value even with the changing parameter $k$.
CASE I: Upward parabola or $k>0$. So if we add the condition that $p(1/2) \ge 0$, then the rest of the function will also certainly satisfy this, not only in the interval $[-1,1]$. Therefore $k/4 - k/2 + 1 \ge 0 \Rightarrow \boxed{0<k \le 4}$
CASE II: Downward parabola or $k<0$. Here, we know that the boundaries matter. Specifically, the boundary that is more far apart from the vertex will decide what happens (try drawing it). We thus want $p(-1) \ge 0 \Rightarrow 2k + 1 \ge 0 \Rightarrow \boxed{-1/2 \le k <0}$
And of course, the trivial case $k=0$ deserves a special mention.