Move validation logic into resources/Kubernetes.js.

Improve some error handling.