<p>I have an on-premise kubernetes cluster v1.22.1 (1 master &amp; 2 worker nodes) and wanted to run jenkins slave agents on this kubernetes cluster using kubernetes plugin on jenkins. Jenkins is currently hosted outside of K8s cluster, running  2.289.3. For Kubernetes credentials in Jenkins Cloud, I have created new service account with cluster role cluster-admin and provided token secret text to Jenkins. The connection between Jenkins and Kubernetes has been established successfully however when I am running a jenkins job to create pods in kubernetes, pods are showing error and not coming online.</p>
<p>Below are the Kubernetes Logs.
<a href="https://i.stack.imgur.com/Kj6qm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Kj6qm.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/xVVg1.png" rel="noreferrer"><img src="https://i.stack.imgur.com/xVVg1.png" alt="enter image description here" /></a></p>
<p>Jenkins logs
<a href="https://i.stack.imgur.com/03cJw.png" rel="noreferrer"><img src="https://i.stack.imgur.com/03cJw.png" alt="enter image description here" /></a>
Has any experienced such issue when connecting from Jenkins master, installed outside of kubernetes cluster?</p>

<p>Under your pod spec you can add <code>automountServiceAccountToken: false</code>.
As described <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server" rel="nofollow noreferrer">here</a></p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Pod
metadata:
  name: my-pod
spec:
  serviceAccountName: build-robot
  automountServiceAccountToken: false
  ...
</code></pre>
<p>This will not work if you need to access the account credentials.</p>
