Do we know when they originated/where they came from? How did this particular setup became so widely known? Are there any examples of the first knock-knock jokes?
First of all I think we can safely ignore the Shakespeare claims which the internet is full of, Shakespeare does have the lines 'Knock Knock. Who's there?' In Macbeth, but since what follow does not seem to be a punch line or a play on words this is very unlikely to be the origin of the joke. I would not however rule out the possibility that the earliest versions were parodies or pastiches of this famous scene.
The earliest print reference I can find cited for recognisable knock knock jokes is from 1929 when the formula is included in the book 'The Games of Children: Their Origin and History' by Henry Betts. It's described as being part of a parlour game called 'buff'. Betts describes the game as being new to him, so it's possible that the actual origin date was around that time.
By 1936 a Pennsylvania Newspaper is reporting on the growing popularity of knock knock jokes, the article explains the joke format to the readers which indicates that it hasn't really hit mainstream culture by this point.
By the 1950s knock knock jokes are appearing in other English speaking countries outside the US and in other languages, given the timing it seems likely that the format could have been spread by American soldiers during WWII and by the emerging mass broadcast media.
And a bit of silliness. My favourite one as a child:
Knock Knock
Who's there?
Dish washer.
Dish washer who?
Dish washn't the way I shpoke before I got falsh teef.