<p>Having:</p>
<pre><code>kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  namespace: default
  name: example-role
rules:
- apiGroups: [&quot;&quot;]
  resources: [&quot;pods&quot;]
  verbs: [&quot;get&quot;, &quot;watch&quot;, &quot;list&quot;]
</code></pre>
<p>And rolebinding:</p>
<pre><code>kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: example-rolebinding
  namespace: default
subjects:
- kind: User
  name: example-user
  apiGroup: rbac.authorization.k8s.io
roleRef:
  kind: Role
  name: example-role
  apiGroup: rbac.authorization.k8s.io
</code></pre>
<p>How can I get the secret token?</p>
<pre><code>token=$(kubectl get secret/$name -o jsonpath='{.data.token}' | base64 --decode)
</code></pre>
<p>But there is no secret for the user only the &quot;default-token-xxx&quot;.</p>
<p>Do I need to bind a services account or is the token added to default-token-xxx?</p>

<p>All Kubernetes clusters have two categories of users: service accounts managed by Kubernetes, and normal users, and a third subject: Groups. Kubernetes does not have objects (kinds) which represent normal user accounts. Normal users cannot be added to a cluster through an API call. Normal users are typically managed or authenticated through integrations with other authentication protocols such as LDAP, SAML, Azure Active Directory, Kerberos, etc. You can leverage an external identity provider like OIDC to authenticate through a token.</p>
<p>For Service Accounts, as you've correctly noticed, if you don't explicitly create a <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/" rel="nofollow noreferrer">Kubernetes Service Account</a> in your namespace, you'll only have access to the default service account, which will be <code>default-token-&lt;hash&gt;</code>.</p>
<p>A token is not automatically created for a &quot;Normal User&quot;, but is automatically created for a Service Account. Service accounts are users managed by the Kubernetes API. They are bound to specific namespaces, and created automatically by the API server or manually through API calls. Service accounts are tied to a set of credentials stored as Secrets.</p>
<p>Kubernetes uses client certificates, bearer tokens, an authenticating proxy, or HTTP basic auth to authenticate API requests through authentication plugins. As HTTP requests are made to the API server, plugins attempt to associate the following attributes with the request:</p>
<ul>
<li>Username: a string which identifies the end user. Common values might be kube-admin or jane@example.com.</li>
<li>UID: a string which identifies the end user and attempts to be more consistent and unique than username.</li>
</ul>
<p>The subject of user authentication is easier answered if we know what the user authentication integration being used is.</p>
