Ive had ear infections a couple times.
Cause: You are not getting your ears thoroughly dried after showers or dips in water. A huge amount of bacteria have taken residence. The yellow discharge is the body undergoing a battle to kill them.
Treatment: You have to keep the inner ear dry constantly. (no new water in there) If it continues to get wet, you will not get rid of it.
Once dry it will go away within weeks. If allowed to get wet it will take months.
After 2 of these that went months I finally figured it out. Best bet is to dab your ears out with T-paper every time you get out of water or the shower.
The inner ear can get wet 999 times without a prob but the 1000 time you get the ear infection and indeed they are hard to get rid of. Mainly because most people unknowingly cont to allow water in the ear.
Good luck.
I'll have my secretary send you the bill.

j/k