Skip to main content

Dashboard WithOut Proxy

Enable additional Add-Ons

We will need to enable a few additional Kubernetes add-ons to get this functionality up and running.

microk8s enable ingress # Ingress exposes HTTP and HTTPS routes from outside the cluster to services within the cluster.
microk8s enable dashboard # web-based Kubernetes user interface
microk8s enable dns # creates DNS records for services and pods
microk8s enable storage # provide both long-term and temporary storage to Pods in your cluster.

Enable Host Access

We need to alos enable one more additional add-on host-access to enable the access to services running on the host machine via fixed IP address.

We can enable to make use of the default address

microk8s enable host-access

Edit Kubernetes Dashboard Service

We need to edit the kubernetes-dashboard service file which provides dash-board functionality. To to edit this we need to edit dashboard service and change service “type” from ClusterIP to NodePort.

We use the following command to edit the file using vim.

kubectl -n kube-system edit service kubernetes-dashboard

This should open the contents of the file in vim and it should look something similar file below

You need to change type to NodePort

# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
 annotations:
 kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"k8s-app":"kubernetes-dashboard"},"name":"kubernetes-dashboard","namespace":"kube-system"},"spec":{"ports":[{"port":443,"targetPort":8443}],"selector":{"k8s-app":"kubernetes-dashboard"}}}
 creationTimestamp: "2022-03-09T14:10:50Z"
 labels:
 k8s-app: kubernetes-dashboard
 name: kubernetes-dashboard
 namespace: kube-system
 resourceVersion: "1029725"
 selfLink: /api/v1/namespaces/kube-system/services/kubernetes-dashboard
 uid: b2608643-a712-4b44-abad-160cf140df49
spec:
 clusterIP: 10.152.183.220
 clusterIPs:
 - 10.152.183.220
 externalTrafficPolicy: Cluster
 internalTrafficPolicy: Cluster
 ipFamilies:
 - IPv4
 ipFamilyPolicy: SingleStack
 ports:
 - nodePort: 30536
 port: 443
 protocol: TCP
 targetPort: 8443
 selector:
 k8s-app: kubernetes-dashboard
 sessionAffinity: None
 type: clusterIP ## Change this to NodePort
status:
 loadBalancer: {}

Once you save and exit the file K8s will automatically restart the service.

We can then get the Port the service is running by using the following command

kubectl -n kube-system get services

Which should display something similar to the below and which we can see that the Dashboard is available on port 30536 in my case





NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
metrics-server ClusterIP 10.152.183.108 <none> 443/TCP 7d4h
dashboard-metrics-scraper ClusterIP 10.152.183.170 <none> 8000/TCP 7d4h
kube-dns ClusterIP 10.152.183.10 <none> 53/UDP,53/TCP,9153/TCP 7d4h
kubernetes-dashboard NodePort 10.152.183.220 <none> 443:30536/TCP 7d4h

We can now open our Firefox browser on any workstation on our network and navigate to https://{server ip}:{port number} in my case it is https://192.168.0.35:30536