Kubernetes

Docker Desktop

Minikube

Running Kubernetes Locally with Docker Desktop and Minikube

Vatsal Bajpai
Vatsal Bajpai
2 min read·
Cover Image for Running Kubernetes Locally with Docker Desktop and Minikube

Running Kubernetes Locally with Docker Desktop and Minikube

Kubernetes is a powerful tool for managing containerized applications, but running a full cluster can be challenging for local development. Using Docker Desktop and Minikube simplifies this process, enabling you to run Kubernetes on your local machine.

Prerequisites

  • Docker Desktop installed
  • Minikube installed
  • kubectl installed

Step-by-Step Guide

1. Install Docker Desktop

Download and install Docker Desktop from the official website. Follow the installation instructions for your operating system.

2. Enable Kubernetes in Docker Desktop

  • Open Docker Desktop.
  • Navigate to Settings > Kubernetes.
  • Check the box Enable Kubernetes.
  • Click Apply & Restart.

Docker Desktop will now configure and start a single-node Kubernetes cluster.

3. Install Minikube

Download and install Minikube from the Minikube website. Follow the installation instructions for your operating system.

4. Start Minikube

Open a terminal and start Minikube:

minikube start --driver=docker

Minikube will set up a single-node Kubernetes cluster using a virtual machine or a Docker container.

5. Verify the Installation

Check the status of your Minikube cluster:

minikube status

Verify the Kubernetes cluster is running:

kubectl get nodes

6. Deploy an Application

Deploying a simple application Create a deployment using kubectl:

kubectl create deployment hello-node --image=k8s.gcr.io/echoserver:1.4

Expose the deployment as a service:

kubectl expose deployment hello-node --type=LoadBalancer --port=8080

Get the URL of the service:

minikube service hello-node --url

7. Access the Application

Open the URL provided by the minikube service command in your web browser to see your running application.

Conclusion

Running Kubernetes locally with Docker Desktop and Minikube simplifies development and testing. You can easily switch between Docker Desktop's built-in Kubernetes and Minikube depending on your needs. This setup ensures you can experiment with Kubernetes without the overhead of managing a full-scale cluster.

If you like this, follow us on Twitter and LinkedIn and explore our platform to help save you more cloud costs - gravitycloud.ai


footer

Share this Article: