kube-tmux
kube-tmux copied to clipboard
How can I dynamically set the context
I have multiple clusters.
I can connect each other by seting KUBECONFIG
environment variable.
The script can get correct output, like this:
(MoeLove) ➜ ~ echo $KUBECONFIG
/home/tao/.kube/kind-config-1
(MoeLove) ➜ ~ sh ~/workspace/kube-tmux/kube.tmux
#[fg=blue]⎈ #[fg=colour]#[fg=]kubernetes-admin@kind-1#[fg=colour250]:#[fg=]default
(MoeLove) ➜ ~ KUBECONFIG=/home/tao/.kube/config
(MoeLove) ➜ ~ sh ~/workspace/kube-tmux/kube.tmux
#[fg=blue]⎈ #[fg=colour]#[fg=]minikube#[fg=colour250]:#[fg=]default
But the tmux status bar can not get correct result.
I know that it did not get the correct environment variable when it executed.
And I want to know how can I do this?
Thanks!