Our client's core team uses kubeconfig with client-go authentication executing a python script to get token. They all use Macs. I use Windows with mingw64. No matter how I try to specify path to that script: forward slashes with drive letter between slashes or classic Windows style (even though it is present in PATH), even if I put the script into the same directory as kube config file and don't specify any path, I get Unable to connect to the server: getting credentials: exec: executable <our script name> not found
. I can execute this script without specifying path to it from CLI just fine.
I'm just trying to kubectl get pods
.
Relevant user:
snippet:
- name: someName
user:
exec:
apiVersion: client.authentication.k8s.io/v1beta1
args:
- --creds
- '%userprofile%\path\to\credentials.properties'
command: path\to\script
env: null
Question: how to specify executable in exec section of kubeconfig in Windows?
Best Answer
Kubernetes client-go already have helper methods for authentication using kubeconfig. It contains two variants with good examples:
I would recommend to use two built-in helper methods instead of rolling a custom variant. You may perhaps want to add an argument so that you can switch between the two, e.g. using out-of-cluster when running locally on Windows and in-cluster when the app (if your code is an app?) is running as a service in the cluster.