services "kubernetes-dashboard" not found when access kubernetes ui

8/30/2019

I am deploy kubernetes UI using this command:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml

start proxy:

kubectl proxy --address='172.19.104.231' --port=8001 --accept-hosts='^*
#x27;

access ui:

curl http://172.19.104.231:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
http://kubernetes.example.com/api/v1/namespaces/kube-system/services/kube-ui/#/dashboard/

the log output:

[root@iZuf63refzweg1d9dh94t8Z ~]# curl http://172.19.104.231:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {

  },
  "status": "Failure",
  "message": "services \"kubernetes-dashboard\" not found",
  "reason": "NotFound",
  "details": {
    "name": "kubernetes-dashboard",
    "kind": "services"
  },
  "code": 404}

how to fix the problem? Check pods status:

[root@iZuf63refzweg1d9dh94t8Z ~]# kubectl get pod --namespace=kube-system
NAME                                    READY   STATUS    RESTARTS   AGE
kubernetes-dashboard-7d75c474bb-b2lwd   0/1     Pending   0          34h
-- Dolphin
kubernetes

5 Answers

12/23/2019

If you use K8S dashboard v2.0.0-betax,

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta8/aio/deploy/recommended.yaml

Then use this to access the dashboard:

http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/

If you use K8S dashboard v1.10.1,

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml

Then use this to access the dashboard:

http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

I also faced the same problem, but then i realized that dashboard v2.0.0-betax and v1.10.1 use different namespace. Latest version use kubernetes-dashboard namespace, but the older one use kube-system namespace

-- maximalyono
Source: StackOverflow

8/30/2019

Apparently, the error message states for not existing k8s Service in kube-system Namespace throughout exposed HTTP API proxy method, as @jt97 mentioned in the answer.

For further reference, you might also consider querying K8s inventory objects, once you have exposed K8s REST API directly within HTTP calls in JSON data format.

For example:

curl http://172.19.104.231:8001/api/v1/namespaces/kube-system/services/

-- mk_sta
Source: StackOverflow

8/30/2019

This message:

"message": "services \"kubernetes-dashboard\" not found"

Simply means that the service doesn't exist.

First of all check if you'r dashboard (service and pod) are working with this command

kubectl get pods,svc --all-namespaces -o wide

Please follow the tutorial Command line proxy

About the problem with pod status, please use this command so you will know why the status is pending instead of running.

kubectl describe pod kubernetes-dashboard-7d75c474bb-b2lwd -n kubernetes-dashboard
-- jt97
Source: StackOverflow


1/20/2020

If you followed instructions from kubernetes.io you might have gotten the wrong link. It's true that service doesn't exist, it might be name that is changed somehow. I had the same issue and noticed that

kubectl get all --all-namespaces

shows (snippet)

kubernetes-dashboard   service/dashboard-metrics-scraper   ClusterIP   10.x.y.z    <none>        8000/TCP                 2d14h
kubernetes-dashboard   service/kubernetes-dashboard        ClusterIP   10.x.x.y   <none>        443/TCP                  2d14h

showed nothing special (as in bored). Try this link and notice the namespace difference:

http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/login

That worked for me

-- Vincent Gerris
Source: StackOverflow