Optimal domains for the kernel operator associated with Sobolev's inequality