I have cocker spaniels. Notorious for awful ears. I also work in a vet clinic and we see a LOT of dogs with ear problems. Unfortunately, a large chunk are even aggressive when it comes time to do ear cleanings.
I never gave mine a choice. We started off slowly, and good behavior was immensely rewarded, but I was also very strict. I first started training them by doing nothing more than using a wet cotton ball to swipe the inside of their ear as puppies. When they got used to this (and sitting very still for it), I started putting up an ear cleaner bottle to their ear and acting as if I'd pour it in, but not. Then, finally I'd put small amounts, and then the amount needed. You should make it as pleasant as absolutely possible.. but ear cleaning is just one of those things that AREN'T pleasant no matter what you do. It DOES feel funny to have liquid in your ear, even if it isn't painful. So for us, it was a combination of immense rewarding for good behavior, and demanding strict compliance to sitting still as I did it, no matter how much they hated it. My cocker spanielhas had more praise and comments regarding her perfect behavior during ear cleaners than I could count on all my fingers and toes. My vet absolutely loves her. Usually "ear problem" exams are a nightmare for vets, but with Cocoa they are a breeze.
If your dog doesn't have recurrent ear infections, but simply gets a little bit of dirt built up, something as simple as water, vinegar, and witch hazel can be used to cleanse the ear. It is easy to make at home, it is not painful, and it is inexpensive. Ointments and other more expensive ear cleaners that you get from your vet are not needed unless your dog develops an ear infection. A gentle cleanser is sufficient. These can be homemade or bought from regular pet supply stores.
And lastly, ALWAYS make sure the ear cleaner is kept in a relatively warm location. If you keep it anywhere in which the bottle is cooled, the dog will NOT appreciate cold liquid being dumped in the ear.