<p>I am creating a GitHub workflow action, to deploy the build into an integration cluster and for that first, I wanted to create a namespace using kubectl, but I am getting an error: <code> error: You must be logged in to the server (Unauthorized)</code></p>
<p>Here is my action.yaml snippet</p>
<pre><code>        uses: cancue/eks-action@v0.0.2
        env:
          aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws_region: $AWS_REGION
          cluster_name: $EKS_CLUSTER_NAME
          kubeconfig: ${{ secrets.INTEGRATION_CLUSTER_SECRETS }}
        with:
          args: |
             kubectl create ns namespace:pr#${{ github.sha }}
</code></pre>
<p>I am new to writing action workflows.
Thanks in advance.</p>

Nitika Gahlawat
<p>you can try out the</p>
<pre><code>- name: verify deployment
      uses: kodermax/kubectl-aws-eks@master
      env:
        KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
      with:
        args: create ns &lt;namespace-name&gt;
</code></pre>
<p>however your config looks good but <strong>makesure</strong> you have added the proper data for <strong>kubeconfig</strong>.</p>
<p>Also, check <code>access_key</code> and <code>secret_key</code> you are using have the access to <strong>EKS</strong> cluster.</p>
<p>Example : <a href="https://github.com/marketplace/actions/kubectl-aws-eks" rel="nofollow noreferrer">https://github.com/marketplace/actions/kubectl-aws-eks</a></p>
<p><strong>Quick fix</strong> :</p>
<p>Once your access &amp; secret set in environment use the command to featch the config from AWS, and you can remove adding the config file in Gitaction seceret.</p>
<pre><code>aws eks update-kubeconfig --region ap-south-1 --name &lt;Cluster name&gt;
</code></pre>
<p><strong>Secrets</strong></p>
<p><strong>KUBE_CONFIG_DATA</strong> – required: A base64-encoded <strong>kubeconfig</strong> file with credentials for Kubernetes to access the cluster. You can get it by running the following command:</p>
<pre><code>cat $HOME/.kube/config | base64
</code></pre>
