kubectl删除机密注册表.gitlab.com



请知道为什么删除机密不起作用吗?

谢谢!

Cloning repository...
Cloning into '/builds/systemxy/actuator-sample'...
Checking out e503a7da as master...
Skipping Git submodules setup
$ echo "$GOOGLE_KEY" > key.json
$ gcloud auth activate-service-account --key-file key.json
Activated service account credentials for: [23232333-compute@developer.gserviceaccount.com]
$ gcloud config set compute/zone europe-west1-c
Updated property [compute/zone].
$ gcloud config set project actuator-sample-224932
Updated property [core/project].
$ gcloud config set container/use_client_certificate True
Updated property [container/use_client_certificate].
$ gcloud container clusters get-credentials actuator-sample
Fetching cluster endpoint and auth data.
kubeconfig entry generated for actuator-sample.
$ kubectl delete secret registry.gitlab.com
**Error from server (Forbidden): secrets "registry.gitlab.com" is forbidden: User "client" cannot delete secrets in the namespace "default"**
**ERROR: Job failed: exit code 1`enter code here**

这有点奇怪,因为gcloud container clusters get-credentials actuator-sample 应该设置正确的凭据和正确的上下文。但是,您的~/.kube/config文件中似乎有错误的"当前上下文"。您可以查看:

$ kubectl config get-contexts

由于看起来您正在使用GKE,您当前的上下文应该是这样的:

CURRENT   NAME                                         CLUSTER                                      AUTHINFO                                     NAMESPACE
*         gke_<project_name>_<region>-<cluster-name>   gke_<project_name>_<region>-<cluster-name>   gke_<project_name>_<region>-<cluster-name>

如果没有,你必须选择上下文:

$ kubectl config use-context gke_<project_name>_<region>-<cluster-name>

最新更新