I have 3 contexts set up in k9s (context1, context2, context3). I know I can change the context within k9s by typing :context but how do I change the default context that loads when I open k9s from context3 to context1?
You can set the default context via kubectl:
kubectl config use-context context1
This will update the default context in your KUBECONFIG, what is the base for k9s.
From your commandline (not inside k9s) you should be able to use kubectl as k9s needs it.
kubectl config get-contextskubectl config use-context <context>$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
dev dev dev
* test test test
my-context idk idk
$ kubectl config use-context my-context
Switched to context "my-context".
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
dev dev dev
test test test
* my-context idk idk
$
Now you see the star on CURRENT on a different value
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With