Refactor kubelet, standalone k8s and integration test to all use the same code.

Large re-factor, unifies stand-alone k8s, kubelet and integration testing code paths.
Same comment for all the functions in this file-- they should be private, and if they can't because they're used outside of kubelet, then they're more general than just kublet and should live in another package.