<p>From time to time, when I submit spark job to Google Kubernetes cluster, I got 401 unauthorized, so I do this <code>gcloud container clusters get-credential my-cluster</code>, but it almost always followed by 403 error, saying client system:anonymous etc., but the weird the part is, I just need to do a simple <code>kubectl get namespace</code>, then it works again, why is that?</p>

<blockquote>
  <p>From time to time, when I submit spark job to Google Kubernetes cluster, I got 401 unauthorized</p>
</blockquote>

<p>Your credentials expire.</p>

<blockquote>
  <p>I do this <code>gcloud container clusters get-credential my-cluster</code>, but it almost always followed by 403 error, saying client system:anonymous etc.</p>
</blockquote>

<p>Sounds like a timing issue where your new credentials and getting propagated in the cluster.</p>
