Obviously we cannot do this and preserve ZFC in the extension, since $M[G]$ will have only one uncountable cardinal. But if you give up power set in the extension, then for certain $\kappa$ you can do this with class forcing. For example, $\text{Coll}(\omega_1,\lt\text{Ord})$ is the forcing having as conditions the countable partial functions from $\omega_1$ to the ordinals, ordered by extension. The generic filter will be a surjection $\omega_1\to\text{Ord}$, which will collapse all cardinals above $\omega_1$ to $\omega_1$ in $M[G]$. This model will not satisfy the power set axiom for uncountable sets, although it will for countable sets, and indeed the CH will hold in this model, as well as the rest of ZFC except for power set.
For any regular $\kappa$, you can first force to make it $\omega_1$, and then do the above forcing, so as to achieve the result with $\kappa$. Singular $\kappa$ are more problematic, and if one wants AC in $M[G]$ this will be impossible, since $\kappa$ will become $\omega_1$ in the extension.
It is interesting to consider the similar model $M[H]$ obtained by collapsing all sets to be countable, thereby producing a model in which every set is countable.