Accessing Kubernetes dashboard on Compute instance in Oracle Cloud

8/4/2018

I have deployed kubernetes and the dashboard onto a compute instance in Oracle cloud.

I have the dashboard installed with grafana onto my compute instance.

NAME                                       READY     STATUS    RESTARTS   AGE
po/etcd-mst-instance1                      1/1       Running   0          1h
po/heapster-7856f6b566-rkfx5               1/1       Running   0          1h
po/kube-apiserver-mst-instance1            1/1       Running   0          1h
po/kube-controller-manager-mst-instance1   1/1       Running   0          1h
po/kube-dns-d879d6bcb-b9zjf                3/3       Running   0          1h
po/kube-flannel-ds-lgklw                   1/1       Running   0          1h
po/kube-proxy-g6vxm                        1/1       Running   0          1h
po/kube-scheduler-mst-instance1            1/1       Running   0          1h
po/kubernetes-dashboard-dd5c889c-6vphq     1/1       Running   0          1h
po/monitoring-grafana-5d4d76cd65-p7n5l     1/1       Running   0          1h
po/monitoring-influxdb-787479f6fd-8qkg2    1/1       Running   0          1h

NAME                       TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)         AGE
svc/heapster               ClusterIP   10.98.200.184    <none>        80/TCP          1h
svc/kube-dns               ClusterIP   10.96.0.10       <none>        53/UDP,53/TCP   1h
svc/kubernetes-dashboard   ClusterIP   10.107.155.3     <none>        443/TCP         1h
svc/monitoring-grafana     ClusterIP   10.96.130.226    <none>        80/TCP          1h
svc/monitoring-influxdb    ClusterIP   10.105.163.213   <none>        8086/TCP        1h 

I am trying to access the dashboard via SSH and did the below in my local computer:

ssh -L localhost:8001:172.31.4.117:6443 opc@xxxxxxxx

However, it tells me this error :

Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

Im not sure what is the best way to access the dashboard. I am new at k8s and still at a beginner stage so would want to consult as I have also tried doing kubectl proxy on my local computer but when i try to access 127.0.0.1 it gives me this error:

I0804 17:01:28.902675   77193 logs.go:41] http: proxy error: dial tcp [::1]:8080: connect: connection refused

Would really appreciaate any help and thank you

-- Adam
kubernetes
oracle-cloud-infrastructure

1 Answer

8/6/2018

Kubernetes includes a web dashboard that can be used for basic management operations.

Once Dashboard is installed on your Kubernetes cluster, it can be accessed in a few different ways.

I prefer to use the kubectl proxy from the command line to access Kubernetes Dashboard.

Kubectl does for you: authentication with API server and forward traffic between your cluster (with Dashboard deployed inside) and your web browser. Please notice that kubectl does it for a local running web browser, as it is running on a localhost.

From the command line:

kubectl proxy

Next, start browsing this address:

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

In case Kubernetes API server is exposed and accessible, you may try:

https://<master-ip>:<apiserver-port>/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

where master-ip is the IP address of your Kubernetes master node where API is running.

On single node setup, another way is use NodePort configuration to access Dashboard.

I found it on dashboard wiki:

Here is a sample of configuration to consider and adapt to your needs:

apiVersion: v1
...
  name: kubernetes-dashboard
  namespace: kube-system
  resourceVersion: "343478"
  selfLink: /api/v1/namespaces/kube-system/services/kubernetes-dashboard-head
spec:
  clusterIP: <your-cluster-ip>
  externalTrafficPolicy: Cluster
  ports:
  - port: 443
    protocol: TCP
    targetPort: 8443
  selector:
    k8s-app: kubernetes-dashboard
  sessionAffinity: None
  type: NodePort

After applying configuration, check for the exposed port for https using the command:

kubectl -n kube-system get service kubernetes-dashboard

If it returned for example 31707, you could start your browser with:

https://<master-ip>:31707

I was inspired by web ui dashboard guide and accessing dashboard wiki.

-- d0bry
Source: StackOverflow