Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

kubernetes

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='^*$'

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
like image 881
Dolphin Avatar asked Aug 30 '19 01:08

Dolphin


Video Answer


1 Answers

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

like image 183
maximalyono Avatar answered Oct 09 '22 07:10

maximalyono