Setting up Kubernetes Dashboard with Kind

Introduction

In a previous article, I guided you through using Helm to deploy on Google Kubernetes Engine. However, if you want to cut down costs by using Kubernetes in your local environment instead of relying on a cloud provider during dev…


This content originally appeared on DEV Community and was authored by chauhoangminhnguyen

Introduction

In a previous article, I guided you through using Helm to deploy on Google Kubernetes Engine. However, if you want to cut down costs by using Kubernetes in your local environment instead of relying on a cloud provider during development, then Kind is your go-to.

There are several tools to help set up Kubernetes locally, such as MiniKube, Kind, K3S, KubeAdm, and more. Each tool has its own pros and cons. In this article, I'll walk you through using Kind to quickly set up a Kubernetes cluster on Docker. Kind stands out for its compactness, making Kubernetes start up quickly, being user-friendly, and supporting the latest Kubernetes versions.

Helm Kind K8s

Working with Kind

Firstly, follow the instructions here to install Kind according to your operating system.

If you're using Ubuntu, execute the command:

[ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind

After successfully installing Kind, you can check its version with the following command:

Kind version

To create a cluster, use this command:

kind create cluster --name {cluster name}

# ex
kind create cluster --name local

Kind create cluster

Use Helm to set up the Kubernetes Dashboard

The Kubernetes Dashboard is a tool for managing Kubernetes clusters with an easy-to-use web UI.

First, add the Kubernetes Dashboard repository:

helm repo add {repo name} https://kubernetes.github.io/dashboard

# ex
helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard

Next, install the chart:

helm upgrade --install {release name} k8s-dashboard/kubernetes-dashboard --create-namespace -n {namespace}

# ex
helm upgrade --install kubernetes-dashboard k8s-dashboard/kubernetes-dashboard --create-namespace -n kubernetes-dashboard

Please note that you need to successfully create a Kubernetes cluster before you can install a Helm chart.

-n {namespace}: Setting a namespace is optional, but organizing resources by namespace can be helpful, especially if you need to install multiple Helm charts.

Once you've successfully installed the Helm chart, the result will be as follows:

Helm upgrade

You can check if the resources were created successfully like this:

kubectl get all -n {namespace}

# ex
kubectl get all -n kubernetes-dashboard

kubectl get all

Next, forward the port for the service so it can be accessed from localhost.

kubectl port forward

As a result, you can access the Kubernetes Dashboard like this:

K8s dashboard

To generate a token, create a file named service-account.yml with the following content:

apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kube-system
---
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: kube-system

Apply to Create Resources:

kubectl apply

Next, generate a token like this:

Generate token

Use that token to login to the Kubernetes Dashboard.

K8s dashboard homepage

See you again in the next articles!

If you found this content helpful, please visit the original article on my blog to support the author and explore more interesting content.

BlogspotBlogspotDev.toFacebookX

Some series you might find interesting:


This content originally appeared on DEV Community and was authored by chauhoangminhnguyen


Print Share Comment Cite Upload Translate Updates
APA

chauhoangminhnguyen | Sciencx (2024-09-21T14:00:00+00:00) Setting up Kubernetes Dashboard with Kind. Retrieved from https://www.scien.cx/2024/09/21/setting-up-kubernetes-dashboard-with-kind/

MLA
" » Setting up Kubernetes Dashboard with Kind." chauhoangminhnguyen | Sciencx - Saturday September 21, 2024, https://www.scien.cx/2024/09/21/setting-up-kubernetes-dashboard-with-kind/
HARVARD
chauhoangminhnguyen | Sciencx Saturday September 21, 2024 » Setting up Kubernetes Dashboard with Kind., viewed ,<https://www.scien.cx/2024/09/21/setting-up-kubernetes-dashboard-with-kind/>
VANCOUVER
chauhoangminhnguyen | Sciencx - » Setting up Kubernetes Dashboard with Kind. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/09/21/setting-up-kubernetes-dashboard-with-kind/
CHICAGO
" » Setting up Kubernetes Dashboard with Kind." chauhoangminhnguyen | Sciencx - Accessed . https://www.scien.cx/2024/09/21/setting-up-kubernetes-dashboard-with-kind/
IEEE
" » Setting up Kubernetes Dashboard with Kind." chauhoangminhnguyen | Sciencx [Online]. Available: https://www.scien.cx/2024/09/21/setting-up-kubernetes-dashboard-with-kind/. [Accessed: ]
rf:citation
» Setting up Kubernetes Dashboard with Kind | chauhoangminhnguyen | Sciencx | https://www.scien.cx/2024/09/21/setting-up-kubernetes-dashboard-with-kind/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.