On multi-component Ermakov systems in a two-layer fluid: a variational approach