Deploying a Kubernetes Cluster Using Minikube
Minikube is a tool that makes it easy to run Kubernetes locally. It runs a single-node Kubernetes cluster inside a VM on your laptop for users looking to try out Kubernetes or develop with it day-to-day. Below are the steps and essential commands for deploying a Kubernetes cluster using Minikube.
Prerequisites
- A computer with at least 2GB of RAM and 2 CPUs. 
- Internet connection for downloading Minikube and Kubernetes binaries. 
- Ensure no other hypervisors are running (like VMware or VirtualBox). 
Steps to Deploy Kubernetes Cluster Using Minikube
1. Install Minikube
- Windows: Download the installer or use Chocolatey ( - choco install minikube).
- macOS: Use Homebrew ( - brew install minikube) or download the binary.
- Linux: Download the binary and install it manually. 
2. Start Minikube
- Open a terminal or command prompt. 
- Run the command: - minikube start. This command starts a Minikube VM and Kubernetes cluster. By default, it uses the virtualization technology available on the platform (like Hyper-V, KVM, Docker, etc.).
3. Check Minikube Status
- Run - minikube statusto check the status of the Minikube VM and the Kubernetes cluster running inside it.
4. Access Kubernetes Dashboard
- Run - minikube dashboardto open the Kubernetes dashboard in a web browser.
5. Deploy Applications
- Use - kubectlcommands to deploy applications. For example,- kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.4.
6. Expose Applications
- To access the deployed applications, expose them as services. For example, - kubectl expose deployment hello-minikube --type=NodePort --port=8080.
7. Access the Application
- Use - minikube service hello-minikubeto access the exposed application.
8. Stop Minikube
- When finished, you can stop the Minikube VM with - minikube stop.
9. Delete Minikube Cluster
- If you want to delete the Minikube cluster and start over, use - minikube delete.
Essential Minikube Commands
- minikube start: Starts a Minikube Kubernetes cluster. 
- minikube status: Shows the status of the Minikube cluster. 
- minikube dashboard: Opens the Kubernetes dashboard. 
- minikube stop: Stops the running Minikube cluster. 
- minikube delete: Deletes the Minikube cluster. 
- minikube service [service-name]: Exposes a service to the host system. 
- minikube ip: Displays the IP address of the Minikube VM. 
- minikube addons list: Lists available addons. 
- minikube addons enable [addon-name]: Enables an addon. 
- minikube addons disable [addon-name]: Disables an addon. 
Conclusion
Minikube provides an easy and convenient way to get a Kubernetes cluster up and running locally for development and testing purposes. It’s a great tool for anyone starting out with Kubernetes or those needing a quick way to prototype and test Kubernetes applications. Remember, Minikube is not meant for production use, but it's a valuable tool for learning and experimentation.
Last updated
Was this helpful?