<p>I'm trying to update an image in Kubernetes by using the following command:</p>

<pre><code>kubectl set image deployment/ms-userservice ms-userservice=$DOCKER_REGISTRY_NAME/$BITBUCKET_REPO_SLUG:$BITBUCKET_COMMIT --insecure-skip-tls-verify
</code></pre>

<p>But when I receive the following error:</p>

<pre><code>error: the server doesn't have a resource type "deployment"
</code></pre>

<p>I have checked that i am in the right namespace, and that the pod with the name exists and is running.</p>

<p>I can't find any meaningful resources in regards to this error.</p>

<p>Sidenote: I'm doing this through Bitbucket and a pipeline, which also builds the image i want to use. </p>

<p>Any suggestions?</p>

<blockquote>
  <p>I have a suspicion that it has something to do with user - not much help from the error message.</p>
</blockquote>

<p>@TietjeDK is correct that it is just a misleading error message. It means one of two things is happening (or maybe both): the <code>kubectl</code> binary is newer than the supported version range of the cluster (so: using a v1.11 binary against a v1.8 cluster, for example) or the provided JWT is incorrectly signed.</p>

<p>You should be very very careful with <code>--insecure-skip-tls-verify</code> not only because it's bad security hygiene but also because if a kubeconfig is incorrect -- as is very likely the case here -- then seeing the x509 error is a much clearer indication than trying to troubleshoot an invalid JWT.</p>

<p>The indicator that makes me believe it is actually the signature of the token, and not its contents, is that if it were the contents you would seen an RBAC message <code>User "foo@example.com" cannot list deployments in $namespace namespace</code>, meaning the apiserver did unpack the JWT and found its assertions were insufficient for the operation. But if you sign a JWT using a random key, the JWT will not unpack since it will fail public key validation and be rejected outright.</p>

<p>So, the tl;dr is two-fold:</p>

<ol>
<li>fix the kubeconfig to actually contain the correct certificate authority (CA) for the cluster, so <code>--insecure-skip-tls-verify</code> isn't required</li>
<li>while fixing kubeconfig, issue a new token for the (<code>User</code> | <code>ServiceAccount</code>) that comes from the cluster it is designed to interact with</li>
</ol>
