10

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?

Bhav
  • 1,957
  • 7
  • 33
  • 66

2 Answers2

10

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.

chresse
  • 5,486
  • 3
  • 30
  • 47
0

I think you can change the k9s config.yml file, this link can help you understand better https://k9scli.io/topics/config, normally it is defined like this example:

k9s:
  refreshRate: 2
  maxConnRetry: 5
  enableMouse: false
  headless: false
  logoless: false
  crumbsless: false
  readOnly: false
  noExitOnCtrlC: false
  noIcons: false
  logger:
    tail: 100
    buffer: 5000
    sinceSeconds: 60
    fullScreenLogs: false
    textWrap: false
    showTime: false
  **currentContext**: arn:aws:eks:us-east-1:ID:cluster/account-name
  **currentCluster**: arn:aws:eks:us-east-1:ID:cluster/account-name