<p>When I am trying to access the Kubernetes dashboard service from my local laptop, I am getting the message that site can not be reached.</p>

<p>Procedure followed:</p>

<p>I followed the documentation from the following link,</p>

<p><a href="https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/</a></p>

<p>I created my cluster with one master and one worker node on my premise machine. Each machine is ubuntu 16.04. And I installed kubectl and accessing this cluster from my control vm where I am running Jenkins for ci/cd pipeline. From this control vm I followed to bind the clusterrole and deployed the Kubernetes dashboard as explained in the documentation.</p>

<p>I run the following command for deploying the default dashboard service from my control vm by using kuectl command (outside the cluster):</p>

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

<p>I created the role binding yaml <code>dashboard-adminuser.yaml</code> with following content ,</p>

<pre><code>apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: admin-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: admin-user
  namespace: kubernetes-dashboard
</code></pre>

<p>And created this by using the following command:</p>

<pre><code> kubectl apply -f dashboard-adminuser.yaml
</code></pre>

<p>Accessed the token by using following command:</p>

<pre><code>kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print $1}')
</code></pre>

<p>And run the following command for serving the dashboard service:</p>

<pre><code>kubectl proxy
</code></pre>

<p>When I run the command showing "Starting serving on 127.0.0.1:8001".</p>

<p>And I tried to access the dashboard by putting the following URL on browser,</p>

<p><a href="http://192.168.16.170:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/" rel="nofollow noreferrer">http://192.168.16.170:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/</a></p>

<p>But I am only getting the message that site can not be reached.</p>

<p><strong>Updates</strong></p>

<p>Now I am trying to access using <strong>NodePort mechanism by editing the dashboard service type</strong> to <code>NodePort</code> type. When I am trying to access the URL , I am getting the error like "your connection is not private". I am adding the screenshot below,</p>

<p><a href="https://i.stack.imgur.com/yZP8X.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yZP8X.png" alt="enter image description here"></a>                                  </p>

<p>Where have I gone wrong?</p>

<p>You need to change the service type to <strong>NodePort</strong> to access it from your local.</p>

<p><strong>NodePort</strong></p>

<p>This way of accessing Dashboard is only recommended for development environments in a single node setup.</p>

<p>Edit kubernetes-dashboard service.</p>

<p>$ <strong>kubectl -n kubernetes-dashboard edit service kubernetes-dashboard</strong></p>

<p>You should see yaml representation of the service. Change type: ClusterIP to type: NodePort and save file. </p>

<pre><code>apiVersion: v1
...
  name: kubernetes-dashboard
  namespace: kubernetes-dashboard
  resourceVersion: "343478"
  selfLink: /api/v1/namespaces/kubernetes-dashboard/services/kubernetes- 
  dashboard
  uid: 8e48f478-993d-11e7-87e0-901b0e532516
spec:
  clusterIP: 10.100.124.90
  externalTrafficPolicy: Cluster
  ports:
   - port: 443
     protocol: TCP
     targetPort: 8443
  selector:
   k8s-app: kubernetes-dashboard
  sessionAffinity: None
  type: ClusterIP
status:
  loadBalancer: {}
</code></pre>

<p>Next we need to check port on which Dashboard was exposed.</p>

<pre><code>$ kubectl -n kubernetes-dashboard get service kubernetes-dashboard

NAME                   TYPE       CLUSTER-IP       EXTERNAL-IP   PORT(S)        
AGE
kubernetes-dashboard   NodePort   10.100.124.90   &lt;nodes&gt;       443:31707/TCP   
21h
</code></pre>

<p>Dashboard has been exposed on port 31707 (HTTPS). Now you can access it from your browser at: <code>https://&lt;master-ip&gt;:31707</code>. master-ip can be found by executing kubectl cluster-info. Usually it is either 127.0.0.1 or IP of your machine, assuming that your cluster is running directly on the machine, on which these commands are executed.</p>

<p>In case you are trying to expose Dashboard using NodePort on a multi-node cluster, then you have to find out IP of the node on which Dashboard is running to access it. Instead of accessing <code>https://&lt;master-ip&gt;:&lt;nodePort&gt;</code> you should access <code>https://&lt;node-ip&gt;:&lt;nodePort&gt;</code>.</p>
