kubie icon indicating copy to clipboard operation
kubie copied to clipboard

support for username and password prompt

Open WMP opened this issue 2 years ago • 0 comments

Hello, i use rancher with tokens with TTL. When my TTL expire, kubectl trying to execute command (cut from kubeconfig):

users:
- name: "kubdev"
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1beta1
      args:
        - token
        - --server=kubdev
        - --user=local
        - --auth-provider=activeDirectoryProvider
      command: rancher

With kubectl without kubie it works:

tom@EliteBook-840-G9:~$ kubectl-1.27 --kubeconfig=/home/tom/.kube/configs/kubdev.yaml get all
Enter credentials for activeDirectoryProvider 
 
Enter username: tom
Enter password: 
INFO[0008] Saving config to /home/tom/.rancher/cli2.json 
NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.43.0.1    <none>        443/TCP   5d6h
tom@EliteBook-840-G9:~$ kubie ctx kubdev
[kubdev|cattle-system] tom@EliteBook-840-G9:~$ kubectl get all
NAME                                  READY   STATUS    RESTARTS   AGE
pod/rancher-84db8566fb-k96hc          1/1     Running   0          44m
(cut here)
[kubdev|cattle-system] tom@EliteBook-840-G9:~$

But when i havent token, and i try to use kubie ctx with behavior.validate_namespaces: true, kubie dont ask me about login and password:

tom@EliteBook-840-G9:~$ kubie ctx kubdev
Error: Error calling kubectl: Enter credentials for activeDirectoryProvider 
 
Enter username: time="2023-08-16T15:04:58+02:00" level=fatal msg=EOF
Enter credentials for activeDirectoryProvider 
 
Enter username: time="2023-08-16T15:04:58+02:00" level=fatal msg=EOF
Enter credentials for activeDirectoryProvider 
 
Enter username: time="2023-08-16T15:04:58+02:00" level=fatal msg=EOF
Enter credentials for activeDirectoryProvider 
 
Enter username: time="2023-08-16T15:04:58+02:00" level=fatal msg=EOF
Enter credentials for activeDirectoryProvider 
 
Enter username: time="2023-08-16T15:04:58+02:00" level=fatal msg=EOF
Unable to connect to the server: getting credentials: exec: executable rancher failed with exit code 1

tom@EliteBook-840-G9:~$

I need to set behavior.validate_namespaces: false to kubie ctx works:

tom@EliteBook-840-G9:~$ kubie ctx kubdev
[kubdev|cattle-system] tom@EliteBook-840-G9:~$ kubectl get all
Enter credentials for activeDirectoryProvider 
 
Enter username: tom
Enter password: 
INFO[0005] Saving config to /home/tom/.rancher/cli2.json 
NAME                                  READY   STATUS    RESTARTS   AGE
pod/rancher-84db8566fb-k96hc          1/1     Running   0          53m
(cut here)

Could you add forwarding for STDIN from kubectl command?

WMP avatar Aug 16 '23 13:08 WMP