How do I remove the Kubernetes dashboard resources from my deployment on Google Cloud Platform?

Chris Stryczynski picture Chris Stryczynski · Sep 12, 2017 · Viewed 34.4k times · Source

I've created a Kubernetes deployment. However, there seem to be additional pods running - that I'm hoping to be able to delete the unnecessary ones.

I see no need to run the dashboard container. I'd like to remove it to free up CPU resources.

How can I disable this container from starting up? Preferably from the deployment config.

Essentially the following pod:

kubectl get pods --all-namespaces | grep "dashboard"                                  
kube-system   kubernetes-dashboard-490794276-sb6qs                  1/1       Running   1          3d

Additional information:

Output of kubectl --namespace kube-system get deployment:

NAME                   DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
heapster-v1.3.0        1         1         1            1           3d
kube-dns               2         2         2            2           3d
kube-dns-autoscaler    1         1         1            1           3d
kubernetes-dashboard   1         1         1            1           11m
l7-default-backend     1         1         1            1           3d

Output of kubectl --namespace kube-system get rs:

NAME                             DESIRED   CURRENT   READY     AGE
heapster-v1.3.0-191291410        1         1         1         3d
heapster-v1.3.0-3272732411       0         0         0         3d
heapster-v1.3.0-3742215525       0         0         0         3d
kube-dns-1829567597              2         2         2         3d
kube-dns-autoscaler-2501648610   1         1         1         3d
kubernetes-dashboard-490794276   1         1         1         12m
l7-default-backend-3574702981    1         1         1         3d

Answer

freedev picture freedev · Mar 22, 2018

Update 2020-09

To have a clean removal you must to delete a lot of objects. Overtime removing the dashboard has been a common problem, so you can now do this:

kubectl delete -f https://raw.githubusercontent.com/kubernetes/dashboard/master/aio/deploy/recommended/kubernetes-dashboard.yaml

If you don't want do a blind thing and you want know what are you removing just try to execute this:

kubectl get secret,sa,role,rolebinding,services,deployments --namespace=kube-system | grep dashboard

If the output is empty, just double check your dashboard namespace's with the command

kubectl get namespaces

The dashboard is stored in a separate namespace and, depending of your context, the dashboard can be not always in the same namespace. If you want have a deeper look start trying with kubernetes-dashboard or kube-system and always specify the namespace while callin kubectl.