Inspired by blendle/kns, ttx
allows you to switch between Talos contexts.
Additionally, to display the current talos context in your shell prompt. A simple bash ps1 prompt script is available inspired by jonmosco/kube-ps1.
To install ttx simply run:
$ curl https://raw.githubusercontent.com/mikemrm/ttx/refs/heads/main/ttx -o /usr/local/bin/ttx && chmod +x $_
To install talos-ps1 download talos-ps1.sh and add the following to your $HOME/.bashrc
:
source /path/to/talos-ps1.sh
PS1='[\u@\h \W] $(talos_ps1)\$ '
Tip
Ensure yq is installed.
Enable and disable the prompt with taloson
and talosoff
.
[user@host ~] $ taloson
[user@host ~] (⸩⸨|prod-cluster)$ talosctl get nodename
NODE NAMESPACE TYPE ID VERSION NODENAME
10.1.2.10 k8s Nodename nodename 1 c0.prod.example.com
10.1.2.12 k8s Nodename nodename 1 c1.prod.example.com
10.1.2.14 k8s Nodename nodename 1 c2.prod.example.com
[user@host ~] (⸩⸨|prod-cluster)$ ttx dev
[user@host ~] (⸩⸨|dev-cluster)$ talosctl get nodename
NODE NAMESPACE TYPE ID VERSION NODENAME
10.2.2.10 k8s Nodename nodename 1 c0.dev.example.com
10.2.2.12 k8s Nodename nodename 1 c1.dev.example.com
10.2.2.14 k8s Nodename nodename 1 c2.dev.example.com
[user@host ~] (⸩⸨|dev-cluster)$ talosoff
[user@host ~] $