<p>I get <code>Please enter Username</code> when I try to deploy with a ServiceAccount, even I have set ClusterRole bindings - do you know why?</p>

<p>kubectl:</p>

<pre><code>kubectl apply -f deployment.yaml
</code></pre>

<p>Role &amp; binding:</p>

<pre><code>kubectl create clusterrole tutorial-role \
               --verb=get,list,watch,create,update,patch,delete \
               --resource=deployments


kubectl create clusterrolebinding tutorial-binding \
             --clusterrole=tutorial-role \
             --serviceaccount=default:tutorial-service
</code></pre>

<p>Create config user:</p>

<pre><code>TOKEN=$(kubectl describe secrets "$(kubectl describe serviceaccount tutorial-service | grep -i Tokens | awk '{print $2}')" | grep token: | awk '{print $2}')
kubectl config set-credentials tutorialuser --token=$TOKEN
kubectl config set-context sausercontext --cluster=&lt;my-cluster&gt; --user=tutorialuser
kubectl config use-context sausercontext --namespace=default
</code></pre>

<p>Deployment:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: leeroy-web
  labels:
    app: leeroy-web
spec:
  replicas: 1
  selector:
    matchLabels:
      app: leeroy-web
  template:
    metadata:
      labels:
        app: leeroy-web
    spec:
      containers:
        - name: leeroy-web
          image: gcr.io/appsyouwear/leeroy-web
          ports:
            - containerPort: 8080
</code></pre>

<p>Info:</p>

<pre><code>kubernetes % kubectl -v=8 apply -f deployment.yaml   
I0111 13:57:05.950317   63261 loader.go:359] Config loaded from file /Users/username/.kube/config
Please enter Username:
</code></pre>

Chris G.
<p>if you are using kops then you can fix this by entering below command</p>
<pre><code>kops export kubecfg --admin
</code></pre>
<p>or you can try this</p>
<pre><code>kops update cluster ${NAME} --yes --state ${KOPS_STATE_STORE} --admin
</code></pre>
<p>or by exporting KOPS_STATE_STORE</p>
<pre><code>export KOPS_STATE_STORE=s3://test-new-store
</code></pre>
<p>if you have not created s3 bucket then follow the below commands to create</p>
<pre><code>aws s3 mb s3://test-new-store --region ap-south-1

aws s3api put-bucket-versioning --bucket test-new-store --versioning-configuration Status=Enabled

export KOPS_STATE_STORE=s3://test-new-store
</code></pre>
