Starship Prompt Builder

Kubernetes module

Show the active Kubernetes context, namespace, user, and cluster with context-specific aliases.

When it appears

It is disabled by default. Once enabled, it renders when a current Kubernetes context is available.

Preview

Rendered from the starting configuration in a representative simulated environment.

starship — preview
on ☸ prodweb  

Starting configuration

[kubernetes]
disabled = false
format = "on [$symbol$context($namespace )]($style) "
style = "bold cyan"
Open in the builder

The configuration is compressed into the URL fragment and stays in your browser.

Key options

formatstring
The format for the module.
symbolstring
A format string representing the symbol displayed before the Cluster.
stylestring
The style for the module.
disabledboolean
Disables the kubernetes module.
context_aliasesobject
Table of context aliases to display.
user_aliasesobject
Table of user aliases to display.
contextsarray
Customized styles and symbols for specific contexts.

Format variables

$symbol
Mirrors the value of option symbol
$context
The current kubernetes context name
$namespace
If set, the current kubernetes namespace
$user
If set, the current kubernetes user
$cluster
If set, the current kubernetes cluster

Common adjustments

  • Use context_aliases to shorten generated cloud-provider context names.
  • Use contexts for style and symbol changes that make production clusters unmistakable.
  • Keep namespace conditional because some contexts do not report one.