Openshift CLI: Change .kube folder to different drive

880 Views Asked by At

I have Openshift CLI 3.11 installed on my machine, but my .kube folder is present on my H drive(network drive) which is not accessible due to some network problems as I'm away from my office and connected remotely . So whenever I try to login from CLI with 'oc login xxxx:port', I get below error

enter image description here

How can I change my .kube location to C drive .

2

There are 2 best solutions below

0
On

In my understanding, you want to specify other kubeconfig file path instead of $HOME/.kube/config. Is it right ? Then this reference would be helpful for you. Refer Loading and Merging Rules for more details.

For instance, you can specify the kubeconfig "--config" option or KUBECONFIG environment value as follows.

$ oc login --config /path/to/your/config -u USERNAME -p PASSWORD

OR

$ KUBECONFIG=/path/to/your/config oc login -u USERNAME -p PASSWORD
0
On

Check the HOME environment variable as well as the HOMEDRIVE, it might be something like (example checked on git-bash):

$ echo $HOME
/H/

Change it with

$ HOME=/O/

If it still complaints, check the rest of enviroment variables (still git-bash)

printenv | less