Flexible Potentiometer Strip
This used to be so easy ... you're looking for an edgewise potentiometer, which was built into the knob. Often only the edge of the knob projected through the case. But try as I can, I can't find them nowadays.

You might try building this into a knob that fits over it, with a short D-shaft projecting through the cavity to turn it.