kubectl delete/create secret forbidden (Google cloud platform)

拟墨画扇 提交于 2019-12-06 01:51:44

问题


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

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

- 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

Things go wrong in this step, I get the following error:

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"

I get the same exact error in the Google cloud shell:

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):

kubectl delete secret registry.gitlab.com 2>/dev/null || echo "secret does not exist"

What am I doing wrong? Thx in advance!


回答1:


RUN gcloud config unset container/use_client_certificate

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



来源:https://stackoverflow.com/questions/50015081/kubectl-delete-create-secret-forbidden-google-cloud-platform

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!