2. Let $k=\int_{0}^{\pi}(\sin x-\cos x) \mathrm{d} x$. If $(1-k x)^{8}=a_{0}+a_{1} x+a_{2} x^{2}+\cdots+a_{8} x^{8}$, then $a_{1}+a_{2}+\cdots+a_{8}=(\quad)$.
(A) -1
(B) 0
(C) 1
(D) 256
2. B.

Notice that, $k=\left.(-\cos x-\sin x)\right|_{0} ^{\pi}=2$. Let $x=1$. Then $\sum_{k=0}^{8} a_{k}=(1-k)^{8}=1$. Since $a_{0}=1$, we have $\sum_{k=1}^{8} a_{k}=0$.