can Kubectl remember me?

3/11/2016

I have implemented basic authentication on my kubernetes api-server, now I am trying to configure my ./kube/config file in a way I could simply run, kubectl get pods

 kubectl config set-cluster digitalocean \
                      --server=https://SERVER:6443 \
                      --insecure-skip-tls-verify=true \
                      --api-version="v1" 
 kubectl config set-context digitalocean --cluster=digitalocean --user=admin
 kubectl config set-credentials admin --password="PASSWORD" 
 kubectl config use-context digitalocean

But now, it asks for credentials twice like :

dev@desktop: ~/code/go/src/bitbucket.org/cescoferraro                                                                   
$ kubectl get pods                                                                                                      
Please enter Username: admin                                                                                             
enter Password: PASSWORD
Please enter Username: admin                                                                                            
Please enter Password: PASSWORD                                                                                      
NAME                                                READY     STATUS    RESTARTS   AGE 

or I need to pass the flags like

kubectl get pods --username=admin --password=PASSWORD

is this the default behavior? I want my config to know me. What can I do?

-- CESCO
coreos
digital-ocean
kubernetes

1 Answer

3/11/2016

Can you provide the output of kubectl config view? I think the problem might be you need to do something like

kubectl config set-credentials cluster-admin --username=admin --password=PASSWORD

instead of

kubectl config set-credentials admin --password="PASSWORD".

-- janetkuo
Source: StackOverflow