<p>How to get the list of namespace in kubernetes with RBAC enable using Python.</p>

<p>I have configured kubernetes in my windows and i have config file with cluster info . After running kubectl proxy , I am able to launch UI dashboard .It requires token and once i added the access token , I am able to fetch namespace and pod details .Once after token expired in 60 minutes . </p>

<p>Again ,UI dashboard is asking new token details.Once I provided new access token,it gives </p>

<blockquote>
  <p>403 unauthorized error.</p>
</blockquote>

<p>Can someone help me why my new access token is not recognized</p>

<p>Access the namespace , pods after giving new access token</p>

<p>The access token is typically associated with a <a href="https://kubernetes.io/docs/reference/access-authn-authz/authentication/#service-account-tokens" rel="nofollow noreferrer">Service Account</a>. It may be that the service account that you used initially doesn't exist anymore.</p>

<p>It may be that you are using a <a href="https://kubernetes.io/docs/reference/access-authn-authz/authentication/#bootstrap-tokens" rel="nofollow noreferrer">Bootstrap Token</a> that looks something like this: <code>781292.db7bc3a58fc5f07e</code> if that's the case, these expire after 60 minutes and you will have to generate a new one. Assuming you created your cluster with <a href="https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm/" rel="nofollow noreferrer">kubeadm</a> you can regenerate it like this:</p>

<pre><code>$ kubeadm token generate
</code></pre>
