求函数\( y=\sqrt{\text{cosx}}\)定义域 ( )
A. \( {[\text{k}}_{\pi },(k+1)\pi \left]\right(k\in \text{Z})\)
B. \( [-\frac{\pi }{2}+k\pi ,\frac{\pi }{2}+k\pi ](k\in \text{Z})\) C. \( [2k\pi ,(2k+1\left)\pi \right](k\in \text{Z})\) D. \( [-\frac{\pi }{2}+2k\pi ,\frac{\pi }{2}+2k\pi ](k\in \text{Z})\)