Skip to content

Conversation

@uozalp
Copy link
Contributor

@uozalp uozalp commented Dec 3, 2025

Currently, k9s requires a valid kubectl context to be set before starting. If no context is configured or the configured context is unavailable, k9s fails to start with connection errors.

This PR changes that behavior:

  • k9s now starts successfully even without a valid context
  • Automatically shows the context view when no connection is available
  • Users can select their desired context from within k9s
  • Eliminates the need to run kubectl config use-context before launching k9s

Use case:
Switch between different clusters (homelab/work) without pre-configuring kubectl context. Simply start k9s and select the appropriate context from the UI.

Backward compatibility:
If a context is set via kubectl config use-context xxx, k9s behavior is unchanged. It will still load the last used view or the view defined in k9s.defaultView. This change only affects users who have no current context configured.

Changes:

  • Skip connection requirement during initialization
  • Prevent cluster updater and plugin loader from running without valid connection
  • Initialize factory/cluster model when switching from no-connection to valid context

Issue: #3705

@uozalp uozalp marked this pull request as ready for review December 3, 2025 19:17
Copy link
Owner

@derailed derailed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@uozalp Nice! Thank you for this update.

@derailed derailed merged commit 381ca5e into derailed:master Dec 13, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants