Unable to deploy kubernetes dashboard on CentOS

7/13/2017

I setup a kubernetes cluster on Windows machine with Virtual Box . I have 4 Guest CentOS 7 systems running. I have setup the cluster using https://kubernetes.io/docs/getting-started-guides/centos/centos_manual_config/ guide. While deploying kubernetes dashboard I got the error

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

Then I executed the command again with -validate=false option. This time I got the below error

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

I have seen that lots of people have got the similar error but could not find the solution anywhere. Output of some of the commands

$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

Please let me know if I am missing something

Thanks Amol

-- Amol
kubernetes

2 Answers

7/13/2017

I'll go thru the errors one-by-one.

Error from server (AlreadyExists): error when creating "kubernetes-dashboard.yaml": serviceaccounts "kubernetes-dashboard" already exists

The above occurs because you have previously deployed the Service called kubernetes-dashboard. The same reasoning applies to services and 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"

The above occurs due to an RBAC version mismatch. RBAC is in beta only from v1.6 onwards. See this. What's the version of kubernetes in your cluster? You have to use v1alpha1 if it's pre v1.6. In fact, if your version of k8s is so old, RBAC is not a requirement. Just leave this be.

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

Tolerations is a fairly new feature that appeared in 1.4 or 1.5. I can't recall. Your version of k8s may not support it.

Also, the tutorial you're using is for k8s v1.1 and has been deprecated as indicated at the top of the page. The version you deployed may be outdated. Based on the errors you encounter, that seems to be the case.

My advise is to tear down the cluster and follow a newer tutorial.

-- Eugene Chow
Source: StackOverflow

10/2/2017

Check your kubectl version

I also faced the same problem with the latest build, and then installed the old version of dashboard.

kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.5.1/src/deploy/kubernetes-dashboard.yaml

-- amit23comp
Source: StackOverflow