Kubernetes 1.8 仪表板配置失败并出现错误 "no kind "Role" is registered for version "rbac.authorization.k8s.io/v1"

Kubernetes 1.8 dashboard configurations fails with error "no kind "Role" is registered for version "rbac.authorization.k8s.io/v1"

我在安装 kubernetes 仪表板时遇到问题,感谢您的意见和解决方案。

错误: 无法解码“https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard-head.yaml": no kind "Role" is registered for version "rbac.authorization.k8s.io/v1" unable to decode "https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard-head.yaml": no kind "RoleBinding" is registered for version "rbac.authorization.k8s.io/v1" unable to decode "https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard-head.yaml”:没有为版本 "apps/v1beta2"

注册种类 "Deployment"

kubectl 版本 客户端版本:version.Info{主要:“1”,次要:“5”,GitVersion:"v1.5.2",GitCommit:“269f928217957e7126dc87e6adfa82242bfe5b1e”,GitTreeState:"clean",BuildDate:“2017-07- 03T15:31:10Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"} 服务器版本: version.Info{Major:"1", Minor:"5 ", GitVersion:"v1.5.2", GitCommit:"269f928217957e7126dc87e6adfa82242bfe5b1e", GitTreeState:"clean", BuildDate:"2017-07-03T15:31:10Z", GoVersion:"go1.7.4", 编译器:"gc", 平台:"linux/amd64"}

kubectl api-版本 apps/v1beta1 authentication.k8s.io/v1beta1 authorization.k8s.io/v1beta1 autoscaling/v1 batch/v1 certificates.k8s.io/v1alpha1 extensions/v1beta1 policy/v1beta1 rbac.authorization.k8s.io/v1alpha1 storage.k8s.io/v1beta1 v1

Pods状态 kube-system kubernetes-dashboard-3725693093-zm11m 0/1 CrashLoopBackOff

如果您没有 RBAC enabled cluster,您将无法使用 RBAC 对象,例如 Role。这就是为什么当试图创建一个 Role 对象时,它没有说它对 Role 对象一无所知。 From the docs

When specified “RBAC” (Role-Based Access Control) uses the “rbac.authorization.k8s.io” API group to drive authorization decisions, allowing admins to dynamically configure permission policies through the Kubernetes API.

您还需要更新的 kubectl 版本,如前所述 in this comment。 RBAC 至少需要 kubectl 1.6 而你有 1.5.