<p>Using kubernetes api</p>
<p><code>https://${MASTERSERVER}:6443/api/v1/namespaces/default/pods --insecure </code>
to create a pod</p>
<p>Getting this error on creation:</p>
<pre><code>{
  &quot;kind&quot;: &quot;Status&quot;,
  &quot;apiVersion&quot;: &quot;v1&quot;,
  &quot;metadata&quot;: {
    
  },
  &quot;status&quot;: &quot;Failure&quot;,
  &quot;message&quot;: &quot;pods is forbidden: User \&quot;system:anonymous\&quot; cannot create resource \&quot;pods\&quot; in API group \&quot;\&quot; in the namespace \&quot;default\&quot;&quot;,
  &quot;reason&quot;: &quot;Forbidden&quot;,
  &quot;details&quot;: {
    &quot;kind&quot;: &quot;pods&quot;
  },
  &quot;code&quot;: 403
}
</code></pre>
<p>How do I add the auth info?</p>

shrw
<p>From the <a href="https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-api/#without-kubectl-proxy" rel="nofollow noreferrer">docs</a> you need to pass an authentication bearer token using <code>Authorization</code> header like below</p>
<pre><code># Gets the token value
TOKEN=$(kubectl get secrets -o jsonpath=&quot;{.items[?(@.metadata.annotations['kubernetes\.io/service-account\.name']=='default')].data.token}&quot;|base64 --decode)

# Explore the API with TOKEN
curl -X GET $APISERVER/api --header &quot;Authorization: Bearer $TOKEN&quot; --insecure
</code></pre>
<p>The output is similar to this:</p>
<pre><code>{
  &quot;kind&quot;: &quot;APIVersions&quot;,
  &quot;versions&quot;: [
    &quot;v1&quot;
  ],
  &quot;serverAddressByClientCIDRs&quot;: [
    {
      &quot;clientCIDR&quot;: &quot;0.0.0.0/0&quot;,
      &quot;serverAddress&quot;: &quot;10.0.1.149:443&quot;
    }
  ]
}
</code></pre>
