There are four ways it is done:
Plan your shoot around the moon phase you want.
Shoot the moon you want separately and edit it in digitally to your shot videos. Composition.
Completely CGI. The moon is simple, and any number of digital video editing suites or plug-ins can do it.
Miniatures. The classic way. Some digital editing to make it nicer.
The 2009 movie Moon used the last method to make great practical and realistic effects.
Q: Your lunar exteriors are quite convincing. How much of that is a real set, and how much is CGI?
A: It’s model miniatures. All the lunar exteriors were shot using that technique, which they used to do in the '70s and '80s. We had a soundstage in Shepperton Studio where we built a piece of lunar landscape, about 30 by 40 feet. We really made it look like the moon. We had these beautiful little miniature vehicles pulled across the landscape by fishing line and titanium wire. That’s basically the foundation of the visuals. We were able to expand upon it in post-production. We digitally created distance, star fields, lens flares and dirt being kicked up by the vehicles. The lens flares were a way of adding visual style to it , but it was also a way of camouflaging certain things.