kubectl Dashboard in docker desktop needs proxy

12/27/2019

I am trying to start kubernetes dashboard in docker for desktop and it's working fine. but all time i need to start kubectl proxy and if i close that powershell window then dashboard working stop.

Is there any way to start dashboard without proxy or proxy start all time? how i can access this dashboard in network ?

-- Vinit Patel
kubernetes
kubernetes-dashboard

1 Answer

12/27/2019

In order to persistently expose the dashboard you have to add a service to your cluster.

Create a yaml file with the following content (Let's call it dash-serv.yaml):

apiVersion: v1
kind: Service
metadata:
  labels:
    k8s-app: kubernetes-dashboard
  name: kubernetes-dashboard-nodeport
  namespace: kube-system
spec:
  ports:
  - port: 80
    protocol: TCP
    targetPort: 9090
    nodePort: 32123
  selector:
    k8s-app: kubernetes-dashboard
  sessionAffinity: None
  type: NodePort

then run kubectl apply -f dash-serv.yaml and test your dashboard access on http://localhost:32123.

-- willrof
Source: StackOverflow