<p>I was following the following tutorial on continuous integration using gitlab and Kubernetes (in my case on google cloud): <a href="https://about.gitlab.com/2016/12/14/continuous-delivery-of-a-spring-boot-application-with-gitlab-ci-and-kubernetes/" rel="noreferrer">https://about.gitlab.com/2016/12/14/continuous-delivery-of-a-spring-boot-application-with-gitlab-ci-and-kubernetes/</a>.</p>

<p>At some point in the tutorial you will have to first delete and then create a secret for the image registry of Gitlab:</p>

<pre><code>- kubectl delete secret registry.gitlab.com
- kubectl create secret docker-registry registry.gitlab.com --docker-server=https://registry.gitlab.com --docker-username=$REGISTRY_USERNAME --docker-password=$REGISTRY_PASSWD --docker-email=$EMAIL
</code></pre>

<p>Things go wrong in this step, I get the following error:</p>

<pre><code>Error from server (Forbidden): secrets "registry.gitlab.com" is forbidden: User "client" cannot delete secrets in the namespace "default": Unknown user "client"
Error from server (Forbidden): secrets is forbidden: User "client" cannot create secrets in the namespace "default": Unknown user "client"
</code></pre>

<p>I get the same exact error in the Google cloud shell:</p>

<p><a href="https://i.stack.imgur.com/mu5my.png" rel="noreferrer"><img src="https://i.stack.imgur.com/mu5my.png" alt="enter image description here"></a></p>

<p>Adding the following line does not really help, I still get the creation error (I am also 100% sure that the deletion also 'crashes' but the '2>/dev/null' just makes it move to the creation step):</p>

<pre><code>kubectl delete secret registry.gitlab.com 2&gt;/dev/null || echo "secret does not exist"
</code></pre>

<p>What am I doing wrong? Thx in advance!</p>

<p>RUN <code>gcloud config unset container/use_client_certificate</code></p>

<p>After this logout and login. It should work. This happens when you disable Legacy Authorisation in the cluster settings, because the client certificate that you are using is a legacy authentication method</p>
