Kubectl configuration changes are not saved via Rancher CLI

4/15/2020

I was trying to change some of my kubernetes cluster configuration via Rancher - kubectl CLI.

Eg: Modifications in namespaces, contexts etc. https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/

But none of these changes persist if I close that active session. Kubeconfig defaults to previous config when I close the CLI. Wanted to check if this is a Rancher issue, as I have no idea.

Eg: Executed the following commands to add/modify cluster and contexts.

kubectl config --kubeconfig=config-demo set-cluster development --server=https://1.2.3.4 --certificate-authority=fake-ca-file

kubectl config --kubeconfig=config-demo set-context dev-frontend --cluster=development --namespace=frontend --user=developer

Then saved the new kube config to environment variable $KUBECONFIG

export KUBECONFIG=$KUBECONFIG:config-demo

which resulted in new kube config, which was cross-verified using

kubectl config view

But when closed the cli session and opened a new session, and typed 'kubectl config view' , it showed the default config instead of new one.

enter image description here

-- Wings2fly
kubernetes
rancher

0 Answers