, Is there a way we can download kube config from...
# general
b
, Is there a way we can download kube config from rancher UI , using python script , currently every day I need to download from UI , as kube config expiration is set for one day
h
Do you have access to master node of the cluster you are downloading kubeconfig for? If so, you can just get a copy from the cluster node For RKE2 it is
/etc/rancher/rke2/rke2.yaml
For K3s its is
Copy code
/etc/rancher/k3s/k3s.yaml
b
NO , we have rancher api access only
h
you maybe able to with rancher cli https://ranchermanager.docs.rancher.com/reference-guides/cli-with-rancher/rancher-cli there is a token command I have never tried this so I am unsure....
m
I use kubeswitch with a bearer-access token to connect to rancher. This way in my terminal I run
switch
, pick my cluster and it auths/grabs a kubeconfig for that session.
h
nice! I am going to save that one
👍 1
m
if you want a config example for rancher, just let me know.
b
in My use case I am login into rancher UI , download kube config to local (.kube/config) folder and accessing it using kubectl In in my next use case I am using python / java client library , I am able to run locally , because kubeconfig it is loading which instantiating client object (I placed config in the source code) , then I am interacting with diff api methods, Next part , I want deploy my app as service which is running in some other environment , as kubeconfig need to referesh everyday it is not doable if deploy as a service, I am Just asking is there way we can download from racher UI using python script