Hey cummins, I haven't taken the time to read through all the replies so I hope I'm not re-stating, or that you're not after additional suggestions.
Here's an idea, although ours applied to an old canned ham travel trailer, you may be able to rig something similar in a truck camper bunk.
Our infant/toddler bed was the upper rear bunk over the sofa bed (our bed). The bunk was simply a canvas sling with two pipes on it's lengthwise edges. Those pipes fit into holders at all four corners, making a "close enough" fit at the ends and along the back wall. This was the original bed. It was the front opening that needed "bars".
I thought in terms of "playpen". I made a wooden frame across the front that pivoted (hinged) along the top (pivots at either end of the frame top fastening to the side walls). It was built in such a way that it couldn't swing open by pushing out on the bottom. So the baby could push on it safely and it wouldn't open.
To open it, you had to push the bottom back in toward the bed, then the whole frame would pivot upward and fasten horizontally. We stored pillows up there during travel, in essence giving us the frame, and the bunk to use as two bedding shelves while under way. The enclosure made for a nice safe sleeping place, and a great daytime playpen out of the way.
The frame was made of: 1x2 top and bottom, and on each side, filled in the middle with appropriately spaced wooden dowels of an adequate diameter.
When we sold the trailer we removed the frame. DW still uses the it today as a drying rack for her herbs in the basement.