kubectl禁止删除/创建秘密(Google云平台) [英] kubectl delete/create secret forbidden (Google cloud platform)

查看:72
本文介绍了kubectl禁止删除/创建秘密(Google云平台)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注以下有关使用gitlab和Kubernetes进行持续集成的教程(在我的情况下是在Google云上):

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/.

在本教程中的某个时候,您将必须先删除Gitlab的图像注册表,然后为其创建秘密:

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"

我在Google云外壳中得到了相同的确切错误:

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

添加以下行并没有真正的帮助,我仍然会遇到创建错误(我也100%确信删除操作也会崩溃",但"2>/dev/null"只会使其移至创建步骤):

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!

推荐答案

运行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

这篇关于kubectl禁止删除/创建秘密(Google云平台)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆