Break out small functions in cmd/kubelet

Minor cleanups I had lingering and remembered as I was reviewing a different PR.
`func getHostname() string {`