<p>Does anyone know how to setup kubectl with jenkins?
Jenkins is running on AWS EC2 which can communicate with AWS EKS Cluster.</p>

<p>when i run shell script in jenkins as kubectl version i get : </p>

<pre><code>+ kubectl version
</code></pre>

<p>output : </p>

<pre><code>Client Version: version.Info{Major:"1", Minor:"10",    GitVersion:"v1.10.3",     GitCommit:"2bba0127d85d5a46ab4b778548be28623b32d0b0",     GitTreeState:"clean", BuildDate:"2018-07-26T20:40:11Z",     GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Error from server (Forbidden): &lt;html&gt;&lt;head&gt;&lt;meta http-equiv='refresh' content='1;url=/login?from=%2Fversion'/&gt;    &lt;script&gt;window.location.replace('/login?from=%2Fversion');&lt;/script&gt;&lt;/head&gt;    &lt;body style='background-color:white; color:white;'&gt;


Authentication required
&lt;!--
You are authenticated as: anonymous
Groups that you are in:

Permission you need to have (but didn't): hudson.model.Hudson.Read
 ... which is implied by: hudson.security.Permission.GenericRead
 ... which is implied by: hudson.model.Hudson.Administer
--&gt;

&lt;/body&gt;&lt;/html&gt;
Build step 'Execute shell' marked build as failure
</code></pre>

aac
<p>One of the ways to configure it in proper way is to use <a href="https://wiki.jenkins.io/display/JENKINS/Kubernetes+Plugin" rel="nofollow noreferrer">Jenkins Kubernetes plugin</a>: <a href="https://illya-chekrygin.com/2017/08/26/configuring-certificates-for-jenkins-kubernetes-plugin-0-12/" rel="nofollow noreferrer">https://illya-chekrygin.com/2017/08/26/configuring-certificates-for-jenkins-kubernetes-plugin-0-12/</a></p>

<p>Another one is to pass cluster kubeconfig file to kubectl.</p>
