2. In $\triangle A B C$, the lengths of the sides opposite to $\angle A$, $\angle B$, and $\angle C$ are $a$, $b$, and $c$ respectively. If
$$
\frac{a}{\cos A}=\frac{b}{2 \cos B}=\frac{c}{3 \cos C},
$$

then the size of $\angle A$ is ( ).
(A) $\frac{\pi}{6}$
(B) $\frac{\pi}{4}$
(C) $\frac{\pi}{3}$
(D) $\frac{5 \pi}{12}$
2. B.

From the Law of Sines, we have
$$
\frac{\sin A}{\cos A}=\frac{\sin B}{2 \cos B}=\frac{\sin C}{3 \cos C},
$$

which means $\tan A=\frac{1}{2} \tan B=\frac{1}{3} \tan C$.
Thus, $\angle A, \angle B, \angle C \in\left(0, \frac{\pi}{2}\right)$.
From $3 \tan A=\tan C=\tan [\pi-(A+B)]$
$=-\tan (A+B)=-\frac{\tan A+\tan B}{1-\tan A \cdot \tan B}$
$=-\frac{\tan A+2 \tan A}{1-2 \tan ^{2} A}$
$\Rightarrow \tan ^{2} A=1 \Rightarrow \angle A=\frac{\pi}{4}$.