<p>I use saml2aws with Okta authentication to access aws from my local machine. I have added k8s cluster config as well to my machine.
While trying to connect to k8s suppose to list pods, a simple <code>kubectl get pods</code> returns an error <code>[Errno 2] No such file or directory: '/var/run/secrets/eks.amazonaws.com/serviceaccount/token' Unable to connect to the server: getting credentials: exec: executable aws failed with exit code 255</code></p>
<p>But if i do <code>saml2aws exec kubectl get pods</code> i am able to fetch pods.</p>
<p>I dont understand if the problem is with storing of credentials or where do i begin to even understand the problem.</p>
<p>Any kind of help will be appreciated.</p>

<p>To Integrate Saml2aws with OKTA , you need to create a profile in saml2aws first</p>
<ul>
<li>Configure Profile</li>
</ul>
<pre><code>saml2aws configure \
  --skip-prompt \
  --mfa Auto \
  --region &lt;region, ex us-east-2&gt; \
  --profile &lt;awscli_profile&gt; \
  --idp-account &lt;saml2aws_profile_name&gt;&gt; \
  --idp-provider Okta \
  --username &lt;your email&gt; \
  --role arn:aws:iam::&lt;account_id&gt;:role/&lt;aws_role_initial_assume&gt; \
  --session-duration 28800 \
  --url &quot;https://&lt;company&gt;.okta.com/home/amazon_aws/.......&quot;
</code></pre>
<blockquote>
<p>URL, region ... can be got from OKTA integration UI.</p>
</blockquote>
<ul>
<li>Login</li>
</ul>
<pre><code>samle2aws login  --idp-account &lt;saml2aws_profile_name&gt;
</code></pre>
<p>that should prompt you for password and MFA if exist.</p>
<ul>
<li>Verification</li>
</ul>
<pre><code>aws --profile=&lt;awscli_profile&gt; s3 ls
</code></pre>
<p>then finally , Just export AWS_PROFILE by</p>
<pre><code>export AWS_PROFILE=&lt;awscli_profile&gt;
</code></pre>
<p>and use awscli directly</p>
<pre><code>aws sts get-caller-identity
</code></pre>
