我在带有Virtual Box的Windows机器上设置了kubernetes集群。我有4个Guest CentOS 7系统正在运行。我使用https://kubernetes.io/docs/getting-started-guides/centos/centos_manual_config/指南设置了群集。在部署kubernetes仪表板时,我收到了错误
Error from server (AlreadyExists): error when creating "kubernetes-dashboard.yaml": serviceaccounts "kubernetes-dashboard" already exists
Error from server (BadRequest): error when creating "kubernetes-dashboard.yaml": ClusterRoleBinding in version "v1beta1" cannot be handled as a ClusterRoleBinding: no kind "ClusterRoleBinding" is registered for version "rbac.authorization.k8s.io/v1beta1"
error validating "kubernetes-dashboard.yaml": error validating data: found invalid field tolerations for v1.PodSpec; if you choose to ignore these errors, turn validation off with --validate=false
然后我再次使用-validate = false选项执行命令。这次我得到了以下错误
Error from server (AlreadyExists): error when creating "kubernetes-dashboard.yaml": serviceaccounts "kubernetes-dashboard" already exists
Error from server (BadRequest): error when creating "kubernetes-dashboard.yaml": ClusterRoleBinding in version "v1beta1" cannot be handled as a ClusterRoleBinding: no kind "ClusterRoleBinding" is registered for version "rbac.authorization.k8s.io/v1beta1"
Error from server (AlreadyExists): error when creating "kubernetes-dashboard.yaml": deployments.extensions "kubernetes-dashboard" already exists
Error from server (AlreadyExists): error when creating "kubernetes-dashboard.yaml": services "kubernetes-dashboard" already exists
我看到很多人都有类似的错误但无法在任何地方找到解决方案。输出一些命令
$kubectl get pods -a -o wide --all-namespaces
Name: kubernetes-dashboard
Namespace: kube-system
Labels: k8s-app=kubernetes-dashboard
Selector: k8s-app=kubernetes-dashboard
Type: ClusterIP
IP: 10.254.25.191
Port: <unset> 80/TCP
Endpoints: <none>
Session Affinity: None
No events.
$kubectl get pods -a -o wide --all-namespaces
No resources found.
$kubectl cluster-info
Kubernetes master is running at http://localhost:8080
$kubectl get nodes
NAME STATUS AGE
centos-minion-1 Ready 2d
centos-minion-2 Ready 2d
centos-minion-3 Ready 2d
如果我错过了什么,请告诉我
由于 AMOL
答案 0 :(得分:1)
检查您的kubectl版本
我也遇到了与最新版本相同的问题,然后安装了旧版本的仪表板。
kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.5.1/src/deploy/kubernetes-dashboard.yaml
答案 1 :(得分:0)
我将逐一解决错误。
Error from server (AlreadyExists): error when creating "kubernetes-dashboard.yaml": serviceaccounts "kubernetes-dashboard" already exists
之前发生的原因是您之前部署了名为kubernetes-dashboard
的服务。相同的推理适用于services
和deployments.extensions
Error from server (BadRequest): error when creating "kubernetes-dashboard.yaml": ClusterRoleBinding in version "v1beta1" cannot be handled as a ClusterRoleBinding: no kind "ClusterRoleBinding" is registered for version "rbac.authorization.k8s.io/v1beta1"
由于RBAC版本不匹配导致上述情况发生。 RBAC仅从v1.6开始测试。见this。你的集群中kubernetes的版本是什么?如果是v1.6之前,你必须使用v1alpha1
。实际上,如果您的k8s版本太旧,则不需要RBAC。请留下这个。
error validating "kubernetes-dashboard.yaml": error validating data: found invalid field tolerations for v1.PodSpec; if you choose to ignore these errors, turn validation off with --validate=false
容差是一个相当新的特征,出现在1.4或1.5中。我不记得了。你的k8版本可能不支持它。
此外,tutorial you're using适用于k8s v1.1,并且已弃用,如页面顶部所示。您部署的版本可能已过时。根据您遇到的错误,情况似乎就是这样。
我的建议是拆除群集并按照新的教程进行操作。