We report on the performance of lumped--elements Kinetic Inductance Detector (KID) arrays for mm and sub--mm wavelengths, operated at 0.3K during the stratospheric flight of the OLIMPO payload, at an altitude of 37.8 km. We find that the detectors can be tuned in-flight, and their performance is robust against radiative background changes due to varying telescope elevation. We also find that the noise equivalent power of the detectors in flight is significantly reduced with respect to the one measured in the laboratory, and close to photon-noise limited performance. The effect of primary cosmic rays crossing the detector is found to be consistent with the expected ionization energy loss with phonon-mediated energy transfer from the ionization sites to the resonators. In the OLIMPO detector arrays, at float, cosmic ray events affect less than 4% of the detector samplings for all the pixels of all the arrays, and less than 1% of the samplings for most of the pixels. These results are also representative of what one can expect from primary cosmic rays in a satellite mission with similar KIDs and instrument environment.