Skip to content

[k8s] Handle invalid kubeconfig parsing #6071

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions sky/provision/kubernetes/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3301,8 +3301,18 @@ def format_kubeconfig_exec_auth_with_cache(kubeconfig_path: str) -> str:
if os.path.isfile(path):
return path

format_kubeconfig_exec_auth(config, path)
return path
try:
format_kubeconfig_exec_auth(config, path)
return path
except Exception as e: # pylint: disable=broad-except
# There may be problems with kubeconfig, but the user is not actually
# using Kubernetes (or SSH Node Pools)
logger.warning(
f'Failed to format kubeconfig at {kubeconfig_path}. '
'Please check if the kubeconfig is valid. This may cause '
'problems when Kubernetes infra is used. '
f'Reason: {common_utils.format_exception(e)}')
return kubeconfig_path


def delete_k8s_resource_with_retry(delete_func: Callable, resource_type: str,
Expand Down