We consider the problem of optimizing the operation of a queuing system in which the number of working service channels can be changed in a controlled manner at control times separated from each other by a fixed time step. It is assumed that, when passing from step to step, the simplest arrival flow intensity changes in accordance with some homogeneous Markov chain. The criterion for choosing a strategy for switching service channels is the minimum total average costs over a multistep planning horizon. The parametric structure of the optimal strategy for switching service channels is revealed.