我无法运行任何helm命令,而不会出现错误消息,说我的用户被禁止。我的用户被禁止使用kube系统和默认名称空间。
运行类似这样的内容: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 stackoverflow和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}
,则可以看到自己的广告连播。
有时,您可能还需要指定tiller
,通常通过添加如下参数来实现:--tiller-namespace={name-of-tiller}
确保检查helm docs或kubectl doc上命令的选项,以便知道使用什么参数。