diff --git a/kubernetes.go b/kubernetes.go index 2196194..d6e843a 100644 --- a/kubernetes.go +++ b/kubernetes.go @@ -147,6 +147,12 @@ func (mi *ModuleInstance) newClient(c goja.ConstructorCall) *goja.Object { func getClientConfig(options KubeConfig) (*rest.Config, error) { kubeconfig := options.ConfigPath if kubeconfig == "" { + // are we in-cluster? + config, err := rest.InClusterConfig() + if err == nil { + return config, nil + } + // we aren't in-cluster home := homedir.HomeDir() if home == "" { return nil, errors.New("home directory not found")