Kubernetes is an open-source system for automating the deployment, scaling, and management of containerized applications. It was originally developed by Google and is now maintained by the Cloud Native Computing Foundation.

Read this blog post or watch the video below to Configure Kubernetes in your local machine with Docker Desktop.

Content

In this blog post, I will cover the installation of Docker Desktop in Local Machine and configuring Kubernetes there. Also I will be showing you how to deploy Dashboard UI for Kubernetes

Things covered today –

    • Configure Docker Desktop and enable Kubernetes
    • Verify Kubernetes Installation
    • Deploy Dashboard UI for Kubernetes

Configure Docker Desktop And Enable Kubernetes

Step 1: Install Docker based on your operating system. Link: https://docs.docker.com/desktop/install/mac-install/

Step 2: Open Docker and enable Kubernetes by going into Settings -> Kubernetes -> Check the box “Enable Kubernetes” -> Hit Apply & restart

Verify Kubernetes Installation

You can verify from the Docker Desktop UI like shown below

The other way to verify is open the terminal and execute the command: kubectl. You should be able to see the list of options available and also the version installed.

Deploy Dashboard UI For Kubernetes

Step 1: Deploy the Dashboard UI

For that go to the link:  https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/ and execute the command. I will always recommend going to this link and getting the official command as the link in the command keep on changing with new versions.

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
Step 2: Create Admin User and Get Bearer Token

Create the YAML file and put the content as –

apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kubernetes-dashboard

Then apply the below command to create the user

kubectl apply -f dashboard-adminuser.yaml

Get the bearer token of the user

kubectl -n kubernetes-dashboard create token admin-user

This will generate the token which you need to copy somewhere as we will need this soon to access the UI.

 

Step 3: Start the Proxy

Start the proxy

kubectl proxy
Step 4: Access the Dashboard

Open the below URL in browser tab

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

Enter the token we generated in the previous step and click on Sign In.

And you should be able to access the Dashboard now.

Conclusion

Kubernetes provides a highly scalable and flexible platform for deploying and managing containerized applications. By abstracting away the underlying infrastructure, it allows developers to focus on writing code and deploying applications, while the Kubernetes system handles the management and scaling of the underlying resources.

In conclusion, running Kubernetes with Docker Desktop on your local machine will provide the setup you need to explore Kubernetes in deep.

In my next post/video, I will be covering How to create Pods and Check Pod Health in Kubernetes. So stay tuned and please provide your feedback in the comment section.

Disclaimer

This article is not endorsed by Salesforce, Google, or any other company in any way. I shared my knowledge on this topic in this blog post. Please always refer to Official Documentation for the latest information.

2 Comments

  1. Tanya

    Thank you for putting things in so simple term. I am looking forward for more such contents in your blog as well as in youtube videos.

    Reply
  2. foobar

    Hi,

    I had to apply this YAML file in order to see all namespaces.

    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: kubernetes-dashboard

    Thanx for the good video!

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *