diff --git a/nodepool/driver/kubernetes/config.py b/nodepool/driver/kubernetes/config.py index 7223ebdc4..221613493 100644 --- a/nodepool/driver/kubernetes/config.py +++ b/nodepool/driver/kubernetes/config.py @@ -109,7 +109,7 @@ class KubernetesProviderConfig(ProviderConfig): provider = { v.Required('pools'): [pool], - v.Required('context'): str, + 'context': str, 'launch-retries': int, } diff --git a/nodepool/driver/kubernetes/provider.py b/nodepool/driver/kubernetes/provider.py index 636cf1b56..268d02105 100644 --- a/nodepool/driver/kubernetes/provider.py +++ b/nodepool/driver/kubernetes/provider.py @@ -49,7 +49,13 @@ class KubernetesProvider(Provider): self.namespace_names.add(pool.name) def _get_client(self, context): - conf = config.new_client_from_config(context=context) + try: + conf = config.new_client_from_config(context=context) + except FileNotFoundError: + self.log.debug("Kubernetes config file not found, attempting " + "to load in-cluster configs") + conf = config.load_incluster_config() + return ( k8s_client.CoreV1Api(conf), k8s_client.RbacAuthorizationV1beta1Api(conf))