It depends a lot on the tank. Basically, for an external temperature sensor, you need to get right down to the tank surface where it either isn't insulated or where you can make a hole in the insulation, above the heating element or heating loop and away from any cold-water inlet. Thermally conductive epoxy would be suitable for bonding most sensors to the tank. You'll need to thermally insulate over the sensor and surrounding area to get a true tank surface temperature.
Consider copying an external tank thermostat - small box for the sensor and connectors, with a spring to hold the sensor against the tank, sat in a square opening cut through the insulation, held in place with a low-stretch strap right round the tank over the sensor box.