For $f(x)$ to be continuous at $x = \frac{\pi}{2}$, the limit of $f(x)$ as $x$ approaches $\frac{\pi}{2}$ must equal $f\left(\frac{\pi}{2}\right)$, which is given as $k$. Thus, $\lim_{x \to \frac{\pi}{2}} f(x) = k$.
We first evaluate the limit:
\[
\lim_{x \to \frac{\pi}{2}} \frac{1 - \sin^3 x}{3 \cos^2 x}
\]
Substituting $x = \frac{\pi}{2}$ yields $\frac{1 - \sin^3(\frac{\pi}{2})}{3 \cos^2(\frac{\pi}{2})} = \frac{1 - 1^3}{3 \cdot 0^2} = \frac{0}{0}$, an indeterminate form.
Applying L'Hopital's Rule:
Differentiate the numerator: $\frac{d}{dx}(1 - \sin^3 x) = -3 \sin^2 x \cos x$.
Differentiate the denominator: $\frac{d}{dx}(3 \cos^2 x) = -6 \cos x \sin x$.
The limit becomes:
\[
\lim_{x \to \frac{\pi}{2}} \frac{-3 \sin^2 x \cos x}{-6 \cos x \sin x} = \lim_{x \to \frac{\pi}{2}} \frac{\sin x}{2} = \frac{\sin(\frac{\pi}{2})}{2} = \frac{1}{2}
\]
For continuity, $k$ must equal this limit.
\[
k = \frac{1}{2}
\]
Therefore, the value of $k$ is $\frac{1}{2}$.