【问题标题】:Forbidden User Error on all Helm commands. How to give user access to Helm?所有 Helm 命令的禁止用户错误。如何授予用户对 Helm 的访问权限?
【发布时间】:2020-01-31 20:01:09
【问题描述】:

我无法运行任何 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 命名空间,但我不明白为什么不能,也不知道如何让自己访问该命名空间。我已经查看了其他几个帖子和问题(例如 this one on stackoverflowthis one on github)。但我无法尝试他们的任何解决方案,因为我总是在 helm 命令上遇到一个禁止用户。

我会很感激任何帮助,并且非常感谢一些关于为什么我的用户根本无法访问的解释。

【问题讨论】:

  • 使用 Helm 3 怎么样?
  • tiller 部署在哪个命名空间?您是否无权访问任何名称空间或仅这些名称空间?您是否能够使用 kubectl 管理其他命名空间中的资源?
  • TillerHelm 3 中已弃用。您是否尝试使用官方文档 helm.sh/docs/intro/install/#from-script 安装 helm?您必须使用 Helm v2 吗?
  • 经过大量研究和询问后,我发现我的用户实际上无法访问集群中的默认或 kube-system 命名空间。我必须指定我有权访问的集群。 (这是一个为安全起见以这种方式设置的群组集群。)感谢您的所有意见。
  • @ineedtoknow 您可以发布您的解决方案作为答案吗?您如何指定对集群的访问权限。它可能会帮助其他有类似问题的用户。

标签: kubernetes namespaces kubernetes-helm kubectl helmfile


【解决方案1】:

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

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

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

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

【讨论】:

  • 仅供参考。在 Helm 3 上,tiller 已弃用。
猜你喜欢
  • 2020-11-29
  • 2019-06-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-12-16
  • 1970-01-01
  • 2019-10-03
  • 1970-01-01
相关资源
最近更新 更多