What kind of keg? Cornie kegs are easy. Initial cleaning if not "reconditionted" ignored here.
Pop the top and rinse out the sludge with the hottest water you have. If have only one keg to clean fill it with about 1 gallon of hot PBW or Oxyclean mix. Shake. Let sit for about 10 minutes. Shake. LEt sit for another 10 minutes. Use CO2 or compressed air to push the fluid out through the beer out side for a cup or two. Pop the top and dump.
Fill a gallon or so with hot water. Shake, dump. Fill with hot water, shake, run about twice as much through the beer out as you did with the cleaner, pop the top and dump. Your keg is now clean but not sanitized.
I use star san or idophor to sanitizer but honestly, if I plan to turn the keg quickly, I do not even bother...not advisable but I honestly did it for years with no issue unless the keg was to be stored warm or be on tap longer than a month.