How to Install and Set Up Kubernetes Dashboard [Step by Step]

choubertsprojects

The Best WordPress plugins!

1. WP Reset

2. WP 301 Redirects

3. WP Force SSL

Kubernetes Dashboard (KD) is a web-based, interactive dashboard for Kubernetes. It provides an overview of your clusters and services with real time operation metrics. The dashboard was designed to be accessible from any machine running the Jetstack browser extension or via kubectl proxy if you are on a local cluster.,

Kubernetes is an open-source container management platform that can be installed on a local machine or on a cloud provider. The Kubernetes dashboard provides users with a way to manage their cluster, visualize the current state of the cluster, and monitor it in real time. This guide will show you how to install and set up the Kubernetes dashboard.

How to Install and Set Up Kubernetes Dashboard [Step by Step]

How do you maintain track of hundreds of Kubernetes containers while they’re all running? A command-line interface isn’t going to cut it. Everything must be represented visually. The Kubernetes dashboard is now available.

Kubernetes Dashboard is the official web-based user interface for Kubernetes, and it consists of a collection of tools that make cluster administration easier.

In this video, you’ll learn how to install and configure the Kubernetes Dashboard on an Ubuntu system step by step.

Prerequisites

This article will be a step-by-step guide. To follow along, make sure you have the following items:

  • Docker must be installed on a system running Ubuntu 14.04.4 LTS or above. This tutorial makes use of Ubuntu 18.04 LTS, Docker v19.038, and the public IP address 13.213.48.113.
  • A cluster of Kubernetes nodes.

How to Install Kubernetes on an Ubuntu Machine is a related article.

Kubernetes Dashboard Installation

You must first install the Kubernetes Dashboard before you can begin to enjoy its advantages, so let’s get started. The kubectl command-line interface tool is required to install Kubernetes Dashboard. Kubernetes Dashboard installation and many other Kubernetes processes are managed via Kubectl, a command-line tool.

Enough with the rhetoric; let’s get started installing the Kubernetes dashboard.

1. Connect to your Kubernetes master node using your chosen SSH client.

2. Next, execute the kubectl apply command to install the Kubernetes dashboard, as shown below. The kubectl apply command downloads the recommended.yaml file and runs the instructions therein to configure each dashboard component.

apply -f kubectl https://raw.githubusercontent.com/kubernetes/dashboard/v2.2.0/aio/deploy/recommended.yaml

kubectl produces a namespace, service account, config map, pods, cluster role, service, RBAC, and deployments resources that constitute the Kubernetes dashboard after running the command.

  • Namespace — This specifies the Kubernetes cluster, including virtual clusters on physical clusters.
  • Service account — Gives processes in a Pod a unique identity.
  • Config Map — A key-value pair of non-confidential data, such as environment variables or command-line arguments, is stored in a Config Map.
  • RBAC – Permissions on the dashboard to manage user roles.
  • A service is a mechanism to expose an application that is executing on several pods.
  • Deployments — Manages the cluster’s resources.
  • Pods – A pod is a collection of one or more containers that share storage and network resources and are operated according to a set of rules.
  • Secrets — Keeps sensitive data like passwords, OAuth tokens, and SSH keys safe.

Running the kubectl apply command to install the Kubernetes dashboardRunning the kubectl apply command to install the Kubernetes dashboard

3. Now, use the kubectl get command to check that all of the resources were successfully installed. The command below retrieves information about all resources in the kubernetes-dashboard (-n) namespace on the cluster.

kubectl kubernetes-dashboard get all -n

All of the resources on the Kubernetes dashboard, such as service, deployment, replica set, and pods, have been successfully deployed in the cluster, as seen below.

Examining all of the resources available on the Kubernetes dashboardExamining all of the resources available on the Kubernetes dashboard

Getting the Kubernetes Dashboard up and running

You should now have a working Kubernetes dashboard, but it still needs some settings to be completely functioning. You must now expose the dashboard service so that it can be accessed from outside the cluster.

Assuming you’re still using the SSH client to connect to the Kubernetes machine:

1. Using the kubectl edit command, modify the Kubernetes dashboard service built in the previous step, as shown below. The command below will open an editable service configuration file with the service configuration shown.

kubectl -n kubernetes-dashboard edit service/kubernetes-dashboard

2. After opening the file, change the service type from ClusterIP to NodePort and save it as shown below. The service is only accessible internally within the cluster (ClusterIP) by default, however switching to NodePort makes it available to the outside world.

When the service type is set to NodePort, any IP address (within or outside the cluster) may access it.

The Kubernetes dashboard service is listening on TCP port 443 in the code snippet below, and it translates TCP port 8443 from port 443 to the dashboard pod port TCP/8443.

# Changed the service’s type to NodePort. ports: 443 (port) targetPort: 8443 protocol: TCP protocol: TCP protocol: TCP protocol: TCP protocol: TCP protocol sessionAffinity: None selector: k8s-app: kubernetes-dashboard NodePort as a type

3. Using the command kubectl get pods, enumerate all pods across all namespaces using the —all-namespaces argument, find the name of each pod generated in step two of the previous section.

A pod with the name kubernetes-dashboard should appear.

—all-namespaces kubectl get pods

Using the command kubectl get podsUsing the command kubectl get pods

4. Using the kubectl delete command, remove the Kubernetes dashboard pod with the name you determined in step three. The pod name for this tutorial is kubernetes-dashboard-78c79f97b4-gjr2l.

You must remove the pod whenever you change the service type. Kubernetes will construct a new one for you with the modified service type to access the full network after it has been destroyed.

kubectl -n kubernetes-dashboard remove pod kubernetes-dashboard-78c79f97b4-gjr2l

5. Run the kubectl get svc —all-namespace command to ensure the kubernetes-dashboard service has the right type. The service type has now been changed to NodePort, and the service exposes the pod’s internal TCP port 30265 through the outside TCP port 443.

obtain svc —all-namespaces kubectl

Running the kubectl get svc --all-namespace commandUsing the command kubectl get svc –all-namespace

6. Create a service account in the kubernetes-dashboard namespace using kubectl create serviceaccount. This service account is required to authenticate any process or application running within a pod container.

kubernetes-dashboard kubectl create serviceaccount dashboard -n

When you establish a service account, you’ll also acquire a service account token, which is saved as a secret object.

7. Use the kubectl get secret command to acquire the service token secret. In the following part, you’ll use this token to access the dashboard.

$(kubectl get serviceaccount dashboard) kubectl get secret -o jsonpath=”.secrets[0].name”) -o jsonpath=”.secrets[0].name”) -o jsonpath=”.secrets | base64 —decode -o jsonpath=”.data.token”

8. Using the kubectl new clusterrolebinding command, build a clusterrolebinding rule that assigns the cluster-admin role to the previously-created service account, giving it complete access to the whole cluster.

create clusterrolebinding using kubectl —clusterrole=cluster-admin —serviceaccount=default:dashboard dashboard-admin -n kubernetes-dashboard

The Kubernetes Dashboard may be accessed here.

The only thing left to do now that you’ve installed and configured the Kubernetes dashboard is to use it!

To access the Kubernetes dashboard, use your preferred browser and go to https://kuberntes-master-node:NodePort/#/login.

The Kubernetes master node is the host where you installed the dashboard, and the node port is the node port from the previous section’s step five.

You must authenticate on the main Kubernetes Dashboard page with either a valid bearer token or a pre-existing kubeconfig file. To access the Kubernetes dashboard in this lesson, use the token created in the previous step.

Login Page for KubernetesLogin Page for Kubernetes

Make sure Token is chosen, and enter the secret token you got in step seven of the previous section. If everything goes according to plan, the dashboard will authenticate you and show you the Services page.

logged into the Kubernetes management consolelogged into the Kubernetes management console

Ensure that resources are shown in the dashboard

Your Kubernetes dashboard is now set up and ready to use. Great! However, as a last effort, let’s make a basic deployment with the dashboard to confirm everything is operating properly.

Let’s start with a simple scenario, such as adding an NGINX service to the cluster through the dashboard, and see how things go.

Assuming you’ve already signed into the Kubernetes dashboard, go ahead and do the following:

From the Service menu, choose the Services option. Each service on the cluster will be visible. Then, in the upper right-hand corner, click the add button (+ symbol), as seen below.

Menu of Kubernetes dashboard servicesMenu of Kubernetes dashboard services

To transmit the service configuration to the cluster, copy and paste the following material into the Create from Input tab and click the upload button.

kind: API service 1st version metadata: name: default NGINX namespace NGINX is a name for a web server that runs on the NGINX protocol. port specifications: – 80-80 is a unique name. TCP port: 80 targetPort: 80 nodePort: 31083 protocol: TCP protocol: TCP protocol: TCP protocol: TCP protocol: TCP protocol: TCP protocol: T selector: nginx cluster nginx cluster nginx cluster nginx cluster nginx clusterIPs: 10.111.160.87 IP: 10.111.160.87 IP: 10.111.160.87 IP: 10.111.160.87 IP: 10.111.160.87 IP: 10.111. external sessionAffinity: None type: NodePort type: NodePort type: NodePort type: NodePort type: Node Cluster ipFamilies: TrafficPolicy – SingleStack IPv4 ipFamilyPolicy load status a balancer:

In the Kubernetes dashboard, create the service.In the Kubernetes dashboard, create the service.

If everything goes properly, the nginx service should appear on the Services tab of the dashboard!

On the Kubernetes dashboard, the NGINX service is installed.On the Kubernetes dashboard, the NGINX service is installed.

On the Kubernetes dashboard, the NGINX service is installed.

Conclusion

You should now be able to install Kubernetes and see the dashboard. The Kubernetes dashboard offers a graphical interface for managing all of your cluster’s resources without having to use the command line.

What apps will you install next to your Kubernetes dashboard now that it’s up and running?

Kubernetes is a cloud-based container orchestration system developed by Google. The Kubernetes Dashboard provides an overview of the cluster’s health and allows users to manage their resources. This tutorial will show you how to install and set up the Kubernetes Dashboard on your computer or server. Reference: kubernetes dashboard plugins.

Related Tags

  • kubernetes-dashboard external access
  • how to access kubernetes dashboard remotely
  • kubernetes dashboard github
  • services kubernetes-dashboard” not found
  • kubernetes dashboard-token

Table of Content