Context. When they are established with sufficient precision, the ages, metallicities and kinematics of Galactic globular clusters (GGCs) can shed much light on the dynamical and chemical evolution of the Galactic halo and bulge. While the most fundamental way of determining GC abundances is by means of high-resolution spectroscopy, in practice this method is limited to only the brighter stars in the nearest and less reddened objects. This restriction has, over the years, led to the development of a large number of techniques that measure the overall abundance indirectly from parameters that correlate with overall metallicity. One of the most efficient methods is measuring the equivalent width (EW) of the calcium II triplet (CaT) at λ ≈ 8500 Å in red giants, which are corrected for the luminosity and temperature effects using the V magnitude differences from the horizontal branch (HB). Aims. We establish a similar method in the near-infrared (NIR), by combining the power of the differential magnitudes technique with the advantages of NIR photometry to minimize differential reddening effects. Methods. We used the K s magnitude difference between the star and the reddest part of the HB (RHB) or of the red clump (RC) to generate reduced equivalent widths (rEW) from previously presented datasets. Then we calibrated these rEW against three previously reported different metallicity scales; one of which we corrected using high-resolution spectroscopic metallicities. Results. We calculated the calibration relations for the two datasets and the three metallicity scales and found that they are approximately equivalent, with almost negligible differences. We compared our NIR calibrations with the corresponding optical ones, and found them to be equivalent, which shows that the luminosity-corrected rEW using the K s magnitude is compatible with the one obtained from the V magnitude. We then used the metallicities obtained from the calibration to investigate the internal metallicity distributions of the GCs. Conclusions. We have established that the ([Fe/H]:rEW) relation is independent of the magnitude used for the luminosity correction and find that the calibration relations change only slightly for different metallicity scales. The CaT technique using NIR photometry is thus a powerful tool to derive metallicities. In particular, it can be used to study the internal metallicity spread of a GC. We confirm the presence of at least two metallicity populations in NGC 6656 and find that several other GCs present peculiar metallicity distributions.