所有 Helm 命令的禁止用户错误。如何授予用户访问 Helm 的权限?

Forbidden User Error on all Helm commands. How to give user access to Helm?

我无法 运行 任何 helm 命令而不会出现错误提示我的用户被禁止。我的用户被禁止使用 kube-system 和默认命名空间。

运行 像这样:kubectl create serviceaccount --namespace kube-system tiller 导致此错误:

Error from server (Forbidden): serviceaccounts is forbidden: User "{my-user}" cannot create resource "serviceaccounts" in API group "" in the namespace "kube-system"

运行 这个:kubectl get serviceaccount [-n kube-system] 导致这个错误:

Error from server (Forbidden): serviceaccounts "[-n" is forbidden: User "cn188854" cannot get resource "serviceaccounts" in API group "" in the namespace "default" Error from server (Forbidden): serviceaccounts "kube-system]" is forbidden: User "cn188854" cannot get resource "serviceaccounts" in API group "" in the namespace "default"

运行 这个:helm list 导致这个错误:

Error: pods is forbidden: User "{my-user}" cannot list resource "pods" in API group "" in the namespace "kube-system"

我猜我的用户无权访问 kube-system 命名空间,但我不明白为什么不能,而且我不知道如何让自己访问该命名空间。我已经查看了其他几个帖子和问题(例如 and this one on github)。但我无法尝试他们的任何解决方案,因为我总是在 helm 命令上遇到禁止用户。

如果能提供任何帮助,我将不胜感激,并非常感谢能解释为什么我的用户根本无法像这样访问。

经过大量研究和询问,我发现我的用户实际上无法访问集群中的默认值或 kube-system namespaces。我必须指定我有权访问的集群。 访问权限取决于您使用的集群的设置方式。 (为了安全起见,我的群组集群就是这样设置的。)

因此,如果其他人遇到此问题,请检查您使用的集群以及您拥有的权限。如果你需要像我一样指定 namespace,你可以将这个参数添加到你的命令中:-n={name-of-namespace-you're-using}

例如,我无法 运行 kubectl get pods,因为我无权访问 default namespace。但是,如果我指定我有权访问的 namespace,例如:kubectl get pods -n={name-of-namespace},那么我将能够看到我的 pods.

有时您可能还需要指定 tiller,通常是通过添加如下参数:--tiller-namespace={name-of-tiller} 确保检查 helm docs, or on the kubectl doc 上命令的选项,以便您会知道使用什么参数。