From 404acc4c1a99a8542a0bf940a82af294c0126258 Mon Sep 17 00:00:00 2001 From: Romil Bhardwaj Date: Mon, 9 Dec 2024 22:43:45 -0800 Subject: [PATCH] Fix incluster auth handling --- sky/clouds/service_catalog/kubernetes_catalog.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sky/clouds/service_catalog/kubernetes_catalog.py b/sky/clouds/service_catalog/kubernetes_catalog.py index 2c7eafc20e5..655b3b54a66 100644 --- a/sky/clouds/service_catalog/kubernetes_catalog.py +++ b/sky/clouds/service_catalog/kubernetes_catalog.py @@ -123,6 +123,10 @@ def _list_accelerators( # clusters defined by allowed_contexts. if region_filter is None: context = kubernetes_utils.get_current_kube_config_context_name() + if context is None and kubernetes_utils.is_incluster_config_available(): + # If context is None and we are running in a kubernetes pod, use the + # in-cluster context as the current context. + context = kubernetes.in_cluster_context_name() else: context = region_filter if context is None: