问题描述
我正在尝试在kubernetes集群上安装一个helm软件包,据说该集群已禁用RBAC.我收到提及clusterroles.rbac.authorization.k8s.io
的权限错误,这是如果启用的RBAC所期望的结果.
I'm trying to install a helm package on a kubernetes cluster which allegedly has RBAC disabled.I'm getting a permission error mentioning clusterroles.rbac.authorization.k8s.io
, which is what I'd expect if RBAC was enabled.
是否可以通过kubectl
检查RBAC是否真的被禁用?
Is there a way to check with kubectl
whether RBAC really is disabled?
我尝试过的事情:
-
kubectl describe nodes --all-namespaces | grep -i rbac
:什么都没出现 -
kubectl describe rbac --all-namespaces | grep -i rbac
:什么都没出现 -
kubectl config get-contexts | grep -i rbac
:什么都没出现 -
k get clusterroles
它显示找不到资源",而不是错误消息.那么这是否意味着启用了RBAC ? -
kuebctl describe cluster
不是东西
kubectl describe nodes --all-namespaces | grep -i rbac
: nothing comes upkubectl describe rbac --all-namespaces | grep -i rbac
: nothing comes upkubectl config get-contexts | grep -i rbac
: nothing comes upk get clusterroles
it says "No resources found", not an error message. So does that mean that RBAC is enabled?kuebctl describe cluster
isn't a thing
我知道这可能是 xy问题,因为我正在安装的头盔包可能希望启用RBAC.但是,我仍然想知道如何检查它是否启用/禁用.
I'm aware that maybe this is the x-y problem because it's possible the helm package I'm installing is expecting RBAC to be enabled. But still, I'd like to know how to check whether or not it is enabled/disabled.
推荐答案
您可以通过执行命令kubectl api-versions
进行检查.如果启用了RBAC,则应该看到API版本.rbac.authorization.k8s.io/v1
.
You can check this by executing the command kubectl api-versions
; if RBAC is enabled you should see the API version .rbac.authorization.k8s.io/v1
.
在AKS中,最好的方法是在 resources.azure.com 上检查群集的资源详细信息.如果可以发现"enableRBAC": true
,则说明您的群集已启用RBAC.请注意,现有的未启用RBAC的AKS群集当前无法更新以供RBAC使用. (感谢@DennisAmeling的澄清)
In AKS, the best way is to check the cluster's resource details at resources.azure.com.If you can spot "enableRBAC": true
, your cluster has RBAC enabled.Please note that existing non-RBAC enabled AKS clusters cannot currently be updated for RBAC use. (thanks @DennisAmeling for the clarification)
这篇关于如何使用kubectl检查RBAC是否已启用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!