Kubernetes 无法在集群范围内创建命名空间

标签 kubernetes namespaces

我尝试使用 kubectl 创建命名空间,但收到此错误:

Error from server (Forbidden): error when creating "namespacefoo": namespaces is forbidden: User "[email protected]" cannot create namespaces at the cluster scope

Kubernetes 中有“范围”的概念吗?我找不到有关不同类型范围的任何信息。如果我无法在集群范围内创建命名空间,我可以在哪里创建命名空间?如何检查我有权访问哪些“范围”?

最佳答案

这取决于您的 Kubernetes 环境。

这个answer suggest (在 Google Cloud environment 中):

That suggests that gcloud config set container/use_client_certificate is set to true i.e. that gcloud is expecting a client cluster certificate to authenticate to the cluster (this is what the 'client' in the error message refers to).

Unsetting container/use_client_certificate by issuing the following command in the glcoud config ends the need for a legacy certificate or credentials and prevents the error message:

gcloud config unset container/use_client_certificate

Issues such as this may be more likely if you are using an older version of gcloud on your home workstation or elsewhere.

仍然,kubernetes/kubernetes issue 62361提到了相同的错误消息。

关于Kubernetes 无法在集群范围内创建命名空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51915228/

相关文章:

c++ - 为什么我们不能在一个类中声明一个命名空间?

javascript - 如何通过函数传递对对象的引用?

java - Solr——从文档收集器访问 reqh 对象

kubernetes - Windows 上的 minikube 启动失败并出现错误 - 获取互斥体超时

kubernetes - 如何将请求分发到 Kubernetes 服务上的 Pod

kubernetes - 部署k8s集群

Python - 将包类导入控制台全局命名空间

PHP 如何获取带有类和命名空间路径的方法名称作为字符串?

load-balancing - 如何为 Kubernetes 负载均衡器指定静态 IP 地址?

kubernetes - "permanent"GKE kubectl 服务帐号认证