<p>Requirement: We need to access the Kubernetes REST end points from our java code. Our basic operations using the REST end points are to Create/Update/Delete/Get the deployments.</p>

<p>We have downloaded the kubectl and configured the kubeconfig file of the cluster in our Linux machine.
We can perform operations in that cluster using the kubectl. We got the bearer token of that cluster running the command 'kubectl get pods -v=8'. We are using this bearer token in our REST end points to perform our required operations. </p>

<p>Questions:</p>

<ol>
<li>What is the better way to get the bearer token? </li>
<li>Will the bearer token gets change during the lifecycle of the cluster?</li>
</ol>

Farooq Rahman
<p>Q: What is the better way to get the bearer token?</p>

<p>A: Since you have configured access to the cluster, you might use </p>

<pre><code>kubectl describe secrets
</code></pre>

<p>Q: Will the bearer token gets change during the lifecycle of the cluster?</p>

<p>A: Static tokens do not expire. </p>

<p>Please see <a href="https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster/" rel="noreferrer">Accessing Clusters</a> and <a href="https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-api/" rel="noreferrer">Authenticating</a> for more details. </p>
