Can I reasonably build a pergola on top of an 8'x12' deck?
It's impossible to suggest a proper structure without much more detail about the existing deck structure. A solution is very likely available, I just can't say what it is. Here's some structural issues that must be addressed to be successful.

The weight of the added structure must be properly transfered into the deck structure. Plus some live load for accumulated snow or simply added safety factor. The weight cannot overload any existing structure or joints, nor the foundation system.

The added structure must resist lateral loads from wind and possibly seismic factors without racking. The railing posts could be adequate, depending on how they tie into the rest of the structure. If not, employ knee braces at every post to resist lateral loads.

You are basically building a parachute. All connections must be tied together so that this thing cannot possibly be blown away in a wind storm. Ties must be employed to transfer uplift loads from the roof all the way down into the foundation. If the existing deck connections do not provide this, they must be reinforced.