Q:

CMB and entropy in the early universe

The Second Law of Thermodynamics states that the entropy of the Universe must increase. When we look a the Cosmic Microwave Background Radiation we see that the early Universe was in thermal equilibrium, which corresponds to a state of maximum entropy. How is it then that the entropy of the Universe is increasing? How is the Second Law consistent with our observations of the CMB?
(Edited for typos)

A:

While the contents of the universe were in nearly perfect thermal equilibrium back then, there was another factor that brought them out of equilibrium: gravity. Being very evenly distributed is a low-entropy state as gravity is concerned. Entropy increases if matter is allowed to clump together, releasing potential energy and creating all sorts of inhomogenities that further disequilibrate the contents. The total entropy has been increasing thanks to an increase of the gravitational part of the entropy, despite the matter/energy contribution becoming somewhat less entropic. 

