Answers: <p>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</p>
  <p><code>--admin</code> in the export command</p>
  
Answers: CC BY-SA 4.0
Answers: 2021-03-30T09:54:58.823Z
Answers: 2021-03-30T09:54:58.823Z
Answers: Kristi Jorgji
Answers: <p>you can fix this by entering below command</p>
  <pre><code>kops export kubecfg --admin
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2022-05-07T19:40:06.543Z
Answers: 2022-05-07T19:40:06.543Z
Answers: yogesh cl
Answers: <p>If you are using test clusters then just use</p>
  <pre><code>kops update cluster ${NAME} --yes --state ${KOPS_STATE_STORE} --admin
  </code></pre>
  <p>Read more at</p>
  <p><a href="https://github.com/kubernetes/kops/blob/master/docs/releases/1.19-NOTES.md#changes-to-kubernetes-config-export" rel="nofollow noreferrer">https://github.com/kubernetes/kops/blob/master/docs/releases/1.19-NOTES.md#changes-to-kubernetes-config-export</a></p>
  
Answers: CC BY-SA 4.0
Answers: 2021-11-28T15:27:32.617Z
Answers: 2021-11-28T15:27:32.617Z
Answers: Prabhat
Body: <p>I created a kubernetes cluster using <code>kops</code> and deployed it in AWS (not EKS manual cluster using <code>kops</code>).</p>
  <p>Then I export in my local machine the configuration like
  <code>kops export kubecfg --state ${KOPS_STATE_STORE} --name ${NAME}</code></p>
  <p>Then running any kubectl command asks for a username, even <code>kubectl</code> version</p>
  <pre><code> kubectl version
  Please enter Username: 
  </code></pre>
  <p>PS: If I <code>ssh</code> into bastion host then <code>ssh</code> into k8s master node, kubectl works fine and its configuration is referring to local user created.</p>
  <p>My local config created from export command into <code>~/.kube/config</code> looks like:</p>
  <pre><code>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: {}
  
  </code></pre>
  <p>And with the config above I cannot do any <code>kubectl</code> command.
  Where can I find the username and password for <code>kubectl</code>?
  I have set authentication as RBAC for the cluster and no limitations.</p>
  <p>I read all article here <a href="https://kubernetes.io/docs/reference/access-authn-authz/authentication/" rel="nofollow noreferrer">https://kubernetes.io/docs/reference/access-authn-authz/authentication/</a> 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.</p>
  
Tags: <kubernetes><kubectl><kops>
Title: kubectl asking for username (k8s cluster created via kops)
UserDisplayName: Kristi Jorgji
ThreadText: # kubectl asking for username (k8s cluster created via kops)
  
  (Asked by: username_0 on 2021-03-30)
  
  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.
  
  **Tags:** kubernetes, kubectl, kops
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_0 on 2021-03-30. Score: 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
  
  
  ---
  
  ### Answer by username_1 on 2022-05-07. Score: 0
  
  you can fix this by entering below command
  
  ```
  kops export kubecfg --admin
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2021-11-28. Score: 0
  
  If you are using test clusters then just use
  
  ```
  kops update cluster ${NAME} --yes --state ${KOPS_STATE_STORE} --admin
  
  ```
  
  Read more at
  
  <https://github.com/kubernetes/kops/blob/master/docs/releases/1.19-NOTES.md#changes-to-kubernetes-config-export>
  
  
  ---
  
  