Subscript[k, j_?EvenQ] = a;
Subscript[k, j_?OddQ] = b;
For extra conditions at $j=0$ and $j=n+1$ you can use a two-index form $k_{n,j}$:
Subscript[k, n_, 0] = 0;
Subscript[k, n_, j_] /; j == n + 1 = 0;
Subscript[k, n_, j_?EvenQ] = a;
Subscript[k, n_, j_?OddQ] = b;
Check:
With[{n = 10}, Table[Subscript[k, n, j], {j, 0, n + 1}]]
{0, b, a, b, a, b, a, b, a, b, a, 0}