Reputation: 409
Is there any command which points me to the path where kubeconfig file is present? I mean I am working on python k8s/openshift client. I am looking for linux or python command or libraries which can print me the path where kubeconfig file is present.
By default kubeconfig is present it home most of the time, but it may also vary for different deployment types.
looking forward to any suggestions/concerns.
Upvotes: 0
Views: 342
Reputation: 21
I used an installer to install the K8's cluster. In my case, it is to be found under oauth folder. (I am not sure about the full correct path) but you can take a look in your k8's folder structure.
Or use the command find in linux to locate the file.
something like: find / -type f -name '*.kubeconfig'
Upvotes: 1
Reputation: 10025
kubectl configuration file is located at ~/. kube/config as default. You can check using this code
kubeconfig_path = os.environ.get('KUBECONFIG', '~/.kube/config')
You can check if the variable is set
kubeconfig_path = os.environ['KUBECONFIG']
and if it's not you can try setting this
os.environ["KUBECONFIG"]=your_config_file_path
Upvotes: 1