AnyGist Article

Running Kubernetes Locally with Minikube

For beginners, the best way to learn Kubernetes is by running a cluster locally. This can be done using Minikube, which allows developers to run a single-node Kubernetes cluster on their laptop.

For beginners, the best way to learn Kubernetes is by running a cluster locally. This can be done using Minikube, which allows developers to run a single-node Kubernetes cluster on their laptop.

https://miro.medium.com/v2/resize%3Afit%3A1400/1%2A_n8kd2cHjQx3Wq00Lk5D2Q.png

 

 

First, install Docker to run containers and install kubectl, the command-line tool used to communicate with Kubernetes clusters.

 

https://fusionauth.io/img/docs/get-started/download-and-install/kubernetes/fa-minikube.png

 

After installation, starting a cluster is as simple as running:

 
minikube start
 

This command creates a local Kubernetes cluster with a control plane and worker node. Once the cluster is running, developers can deploy applications.

For example, to deploy a web server using Nginx, run:

 
kubectl create deployment my-nginx --image=nginx
 

This command creates a deployment and launches a pod running the Nginx container.

To verify the pod is running:

 
kubectl get pods
 

Next, expose the deployment so it can receive traffic:

 
kubectl expose deployment my-nginx --type=NodePort --port=80
 

Finally, open the application in your browser:

 
minikube service my-nginx
 

This launches the Nginx welcome page and confirms your Kubernetes deployment works.

You can also scale the application easily. For example:

 
kubectl scale deployment my-nginx --replicas=5
 

Kubernetes instantly launches five pods running the same application, demonstrating how scalable the system is.

“Explore to Conquer”

— CodeDevPay

Comments

No comments yet. Be the first to share your thoughts.

Leave a comment

You must be logged in to leave a comment.