We report on a near infrared, optical and X-ray simultaneous campaign performed in 2017 with the XMM-Newton and Swift satellites and the HAWK-I instrument mounted on the VLT on the transitional millisecond pulsar PSR J1023+0038. Near infrared observations were performed in fast-photometric mode (0.5s exposure time) in order to detect any fast variation of the flux and correlate them with the optical and X-ray light curves. The optical light curve shows the typical sinusoidal modulation at the system orbital period (4.75hr). No significant flaring or flickering is found in the optical, neither signs of transitions between active and passive states. On the contrary, the near infrared light curve displays a bimodal behaviour, showing strong flares in the first part of the curve, and an almost flat trend in the rest. The X-ray light curves instead show a few low/high mode transitions, but no flaring activity is detected. Interestingly, one of the low/high mode transition is found to happen at the same time as the emission of an infrared flare. This can be interpreted in terms of the emission of an outflow or a jet: the infrared flare could be due to the evolving spectrum of the jet, which possesses a break frequency that moves from higher (near infrared) to lower (radio) frequencies after the launching, that has to happen at the low/high mode transition. We also present the cross correlation function between the optical and near infrared curves. Due to the bimodality of the near infrared curve, we divided it in two parts (flaring and quiet). While the cross correlation function of the quiet part is found to be flat, the one referring to the flaring part shows a narrow peak at ∼10s, which indicates a delay of the near infrared emission with respect to the optical. This lag can be interpreted as reprocessing of the optical emission at the light cylinder radius with a stream of matter spiraling around the system due to a phase of radio-ejection. This strongly supports a different origin of the infrared flares observed for PSR J1023+0038 with respect to the optical and X-ray flaring activity reported in other works on the same source.