1

I created a kubernetes cluster using kops and deployed it in AWS (not EKS manual cluster using kops).

Then I export in my local machine the configuration like kops export kubecfg --state ${KOPS_STATE_STORE} --name ${NAME}

Then running any kubectl command asks for a username, even kubectl version

 kubectl version
Please enter Username: 

PS: If I ssh into bastion host then ssh into k8s master node, kubectl works fine and its configuration is referring to local user created.

My local config created from export command into ~/.kube/config looks like:

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: fakedata=
    server: https://api-test-intern-doesntmatter.eu-central-1.elb.amazonaws.com
  name: test-internet.k8s.local
contexts:
- context:
    cluster: test-internet.k8s.local
    user: test-internet.k8s.local
  name: test-internet.k8s.local
current-context: test-internet.k8s.local
kind: Config
preferences: {}
users:
- name: test-internet.k8s.local
  user: {}

And with the config above I cannot do any kubectl command. Where can I find the username and password for kubectl? I have set authentication as RBAC for the cluster and no limitations.

I read all article here https://kubernetes.io/docs/reference/access-authn-authz/authentication/ and still do not understand what is the default username password why am I asked for such credentials I haven't created any role or user.

1

I solved this temporarily with not the safest solution, but is working When creating secret with kops named admin, can use that to generate user field in exported kops config by adding also

--admin in the export command

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.