How to install Kubernetes dashboard with NodePort

The Kubernetes dashboard is a web-based user interface that provides information about the status of Kubernetes cluster resources and any errors that may occur. Dashboards can be used to deploy containerized applications to a cluster, troubleshoot deployed applications, and perform general management of cluster resources.

The deployment of Deployment, StatefulSet, DaemonSet, Jobs, Services and Ingress can be done from the dashboard or terminal in the following ways kubectl. If you want to scale your deployment, start rolling updates, restart your Pod, create persistent volumes and persistent volume claims, you can do everything from the Kubernetes dashboard.

Step 1: Configure kubectl

We will deploy the dashboard to a Kubernetes cluster using the kubectl kubernetes management tool. You can configure kubectl using the guide below.

Easily manage multiple Kubernetes clusters with kubectl and kubectx

The guide in the link demonstrates how to configure and access multiple clusters using the same kubectl configuration file.

Step 2: Deploy the Kubernetes Dashboard

The default Dashboard deployment contains the minimum set of RBAC privileges required to run. You can deploy the Kubernetes dashboard using the following command.

kubectl apply -f

This will use the default values ​​for deployment. If you want to make some modifications to the file, you must download it to your local computer.

mv recommended.yaml kubernetes-dashboard-deployment.yml

Modify the files to suit your deployment needs.

vim kubernetes-dashboard-deployment.yml

I changed the Kubernetes dashboard service to a NodePort type.

kind: Service
apiVersion: v1
    k8s-app: kubernetes-dashboard
  name: kubernetes-dashboard
  namespace: kubernetes-dashboard
    - port: 443
      targetPort: 8443
    k8s-app: kubernetes-dashboard
  type: NodePort
  • Node port Services are exposed on each node’s IP through a static port (NodePort). The ClusterIP service to which the NodePort service is routed is automatically created.

Apply changes when done:

kubectl apply -f kubernetes-dashboard-deployment.yml

Check the deployment status:

$ kubectl get deployments -n kubernetes-dashboard                              
NAME                        READY   UP-TO-DATE   AVAILABLE   AGE
dashboard-metrics-scraper   1/1     1            1           86s
kubernetes-dashboard        1/1     1            1           86s

Two Pods should be created-one for dashboards and one for metrics.

$ kubectl get pods -n kubernetes-dashboard
NAME                                         READY   STATUS    RESTARTS   AGE
dashboard-metrics-scraper-7b64584c5c-xvtqp   1/1     Running   0          2m4s
kubernetes-dashboard-566f567dc7-w59rn        1/1     Running   0          2m4s

Since I changed the service type to NodePort, please confirm that the service was actually created.

$ kubectl get service -n kubernetes-dashboard       

NAME                        TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)         AGE
dashboard-metrics-scraper   ClusterIP            8000/TCP        2m59s
kubernetes-dashboard        NodePort           443:30038/TCP   3m

Step 3: Visit the Kubernetes dashboard

My service deployment was assigned a port 30038/TCP protocol. Let us confirm that we can access the dashboard.

You need a token to access the dashboard, check out our guide:

How to create an admin user to access Kubernetes dashboard

Create a Kubernetes service / user account limited to one namespace

You should see a web dashboard similar to the one below.

How to install Kubernetes dashboard with NodePort

Nginx entry:

apiVersion: extensions/v1beta1
kind: Ingress
  name: k8s-dashboard
  namespace: kubernetes-dashboard
  annotations: "true" "true"
    - hosts:
      secretName: tls-secret
    - host:
        - path: /
            serviceName: kubernetes-dashboard
            servicePort: 443

Check out other Kubernetes guides:

Top minimal container operating system running Kubernetes

Installing a production Kubernetes cluster with Rancher RKE

Install Minikube Kubernetes on CentOS 8 / CentOS 7 using KVM

How to schedule Pods on Kubernetes control plane (master) node