0

I have 4 kubernetes clusters I need to switch between to check or monitor - sometimes I quickly need to switch back and forth between them.

I see that the kubectl config context is 1 file for the user so if I have 10 terminal windows opened, they will all point to just 1 kubernetes cluster.

Is there a way to have a terminal session in which to maintain the kubernetes context, regardless of what k8s/kubectl context I use in my other terminal session.

I am using either Windows Terminal or bash on Ubuntu.

Borislav T
  • 178
  • 1
  • 1
  • 6

1 Answers1

2

Try checking out this page in the docs, the $KUBECONFIG env variable is easy to manage in different sessions.

As for managing a workspace with multiple sessions - I recommend tmux. It takes a while to get used to, but it allows you to describe your sessions and their environments (you can use send-keys 'export KUBECONFIG=/kubeconfig/for/one/cluster' inside tmux) in a bash script and have different panes export different $KUBECONFIG paths

GNUPepe
  • 46
  • 2