Skip to main content

powerline-k8s

PyPI PyPI_Python_Version License Docs CI codecov

A custom Powerline segment for displaying the current Kubernetes context and namespace.

Installation

Using pip

$ pip install powerline-k8s

Configuration

Colorscheme

Add the following config items to your Powerline colorscheme config file (usually located at ~/.config/powerline/colorschemes/), see Powerline Colorschemes for more info.

{
  "k8s":           { "fg": "solarized:blue", "bg": "solarized:base02", "attrs": [] },
  "k8s_namespace": { "fg": "solarized:red",  "bg": "solarized:base02", "attrs": [] },
  "k8s_context":   { "fg": "solarized:blue", "bg": "solarized:base02", "attrs": [] },
  "k8s:divider":   { "fg": "gray4",          "bg": "solarized:base02", "attrs": [] }
}

Segment

Add the following config item to your Powerline segments config file, see Powerline Segment reference for more info.

{
  "function": "powerline_k8s.k8s",
  "priority": 30
}
  • If adding the segment to the shell, edit ~/.config/powerline/themes/shell/default.json.
  • If adding the segment to the tmux status line, edit ~/.config/powerline/themes/tmux/default.json.

Alternative config location

If your Kubernetes config file is not in the default location ~/.kube/config, you can point to it by setting the value of the $KUBECONFIG environment variable to where your config file is.

Toggle visibility

Toggle entire segment or specific section's visibility with the following environment variables:

  • POWERLINE_K8S_SHOW
  • POWERLINE_K8S_SHOW_NS

Note: Full segment visibility takes precedence over namespace section visibility.

# toggle segment visibility
$ POWERLINE_K8S_SHOW=0 powerline-daemon --replace # hide powerline-k8s segment
$ POWERLINE_K8S_SHOW=1 powerline-daemon --replace # show powerline-k8s segment (default)

# toggle namespace section visibility
$ POWERLINE_K8S_SHOW_NS=0 powerline-daemon --replace # hide namespace section
$ POWERLINE_K8S_SHOW_NS=1 powerline-daemon --replace # show namespace section (default)

Alternatively you can add the following function to your shell for easier toggling:

toggle_powerline_k8s() {
  case "$1" in
    # pass the '-ns' flag to toggle namespace visibility
    "-ns" | "--namespace")
      if [[ "${POWERLINE_K8S_SHOW_NS:-1}" -eq 1 ]]; then
        export POWERLINE_K8S_SHOW_NS=0
      else
        export POWERLINE_K8S_SHOW_NS=1
      fi
    ;;
    *)
      # toggle segment visibility
      if [[ "${POWERLINE_K8S_SHOW:-1}" -eq 1 ]]; then
        export POWERLINE_K8S_SHOW=0
      else
        export POWERLINE_K8S_SHOW=1
      fi
    ;;
  esac
}

Demo

asciicast

Stats

Alt

Release files for powerline-k8s 1.5.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for powerline-k8s 1.5.4
File Size Uploaded
powerline_k8s-1.5.4.tar.gz 37.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for powerline-k8s 1.5.4
File Interpreter ABI Platform
powerline_k8s-1.5.4-py3-none-any.whl Python 3 none any Details

Total release size: 42.4 kB

Release files / powerline_k8s-1.5.4.tar.gz

Download URL powerline_k8s-1.5.4.tar.gz
Size 37.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4c491b88f3cb872720e38f5890565f6f1c93f228a51f52174ee486a30417807d
BLAKE2b-256 checksum
How to use checksums
00701b9640870220b437c919753a485fb465e3d77325588f057f839ebc9d3bfc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 21, 2025.

Transparency log

Release files / powerline_k8s-1.5.4-py3-none-any.whl

Download URL powerline_k8s-1.5.4-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1db3fb31e029b68643fd939a61ec62baf7314f4eb316a3dd6eebf2317f305634
BLAKE2b-256 checksum
How to use checksums
f65bfed883f1f2dca7f4a11990c7ecb8ba552dde6ac79066b8196ef67b75ca24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 21, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.5.4 This release

2 release files

1.5.3

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page