k8s client version 1.9.0 on ubuntu 16.04
k8s server version 1.8.7 on ubuntu 16.04
kops 1.8.1

*I am using kops to create 2 clusters on GCE. Both clusters work 
correctly. * kops creates a context with same name as cluster so i can 
switch from one cluster to another by changing context. 
here you can see that both clusters are accessible:
  kubectl config use-context rnmclusterkops1.k8s.local
  Switched to context "rnmclusterkops1.k8s.local".
  ubuntu@ubuntu-VirtualBox:~/github/scripts$ kubectl get nodes
  NAME                        STATUS    ROLES     AGE       VERSION
  master-us-central1-c-s0mm   Ready     master    7m        v1.8.7
  nodes-s608                  Ready     node      6m        v1.8.7
  nodes-tsrq                  Ready     node      6m        v1.8.7

  kubectl config use-context rnmclusterkops2.k8s.local
  Switched to context "rnmclusterkops2.k8s.local".
  ubuntu@ubuntu-VirtualBox:~/github/scripts$ kubectl get nodes
  NAME                        STATUS    ROLES     AGE       VERSION
  master-us-central1-c-zk6z   Ready     master    2m        v1.8.7
  nodes-fjfc                  Ready     node      1m        v1.8.7
  nodes-gwld                  Ready     node      1m        v1.8.7

I created a new namespace, new username (with basic auth) and context and 
connected them to one of the clusters:

  kubectl config  set-credentials newuser --username=myusername 
--password=mypassword
  User "newuser" set.

  kubectl create namespace my-ns
  namespace "my-ns" created

  kubectl config set-context rnmclusterkops1.k8s.local.user 
--cluster=rnmclusterkops1.k8s.local --namespace=my-ns --user=newuser
  Switched to context "rnmclusterkops1.k8s.local.user

when I use the new context, it says i am unauthorized.
  kubectl config use-context rnmclusterkops1.k8s.local.user
  Switched to context "rnmclusterkops1.k8s.local.user".
  kubectl get nodes
  *error: You must be logged in to the server (Unauthorized)*

I logged into master controller on the cluster and verified that apiserver 
was started with --basic-auth-file=/etc/srv/kubernetes/basic_auth.csv.

Any idea how I can *get authorized (with basic auth) for the new user in 
the new context*?


thanks for the help,
Rod

-- 
You received this message because you are subscribed to the Google Groups 
"Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to kubernetes-users+unsubscr...@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to