While trying to connect to kubernetes cluster using kubeconfig file I am getting below mentioned error
Response: {"error":"invalid_request","error_description":"Refresh token is invalid or has already been claimed by another client."}
Following is the sequence of instruction executed
- create a clientset using the kubeconfig file
config, err := clientcmd.BuildConfigFromFlags("", kubeconfig)
if err != nil {
return nil, err
}
clientset:= kubernetes.NewForConfig(config)
- Connect to the namespace
ns, err := clientset.CoreV1().Namespaces().Get(namespace, metav1.GetOptions{})
if err != nil {
log.Println(err) ///Getting the error at this place
}
if error, get the latest kubeconfig file
execute from step1
If I restart the server and try running this code, it works. But I need a way to make it work without restarting the servers.