How to Run a Local Kubernetes Cluster with Minikube
Minikube is a tool that lets you run a single-node Kubernetes cluster on your personal computer or in EC2 instance so that you can try out Kubernetes.
- More than one CPU
- 20GB of disk space
- 2GB of free memory
- Internet connection, there isn’t a terribly clean way to package the install up to run offline. If you have a good tutorial for this please get in touch with me!
- Something to run a container/virtual machine like Docker, QEMU, Hyperkit, Hyper-V, KVM, Parallels, VirtualBox, or VMware Fusion
The releases page has builds for Linux, OSX, and Windows environments
To start a local single-node Kubernetes cluster, run the command
(you won’t need root to start Minikube)
Use this command to start the cluster and download any other necessary dependencies.
a successful minikube start your output may not look identical to this
If you're having trouble starting minikube, don't worry, just head over to the drivers page where you'll find instructions on how to set up a compatible container or virtual-machine manager.
Interact with your cluster
If you have already installed kubectl, you can use it to access your new cluster.
It’s a good idea to alias the kubectl command to run through Minikube with
At the start, certain services like the storage-provisioner may not be Running yet. This is a typical occurrence when bringing up a cluster and will be resolved shortly.
To open your Kubernetes dashboard, run:
Success! the Minikube dashboard
Deploying a demo service
Create a sample deployment and expose it on port 8080:
It may take a moment, but your deployment will soon appear when you run:
The most efficient way to access this service is to have minikube launch a web browser for you:
Alternatively, use kubectl to forward the port:
Your application is now available at localhost:7080. You can see the request metadata and do a POST request to observe the body in the output.
- Check out Nana’s Kubernetes tutorial on Dev.to
- Vinoth’s guide to running Minikube in an EC2 environment
The limits of Minikube
Minikube is a well-known tool for Kubernetes development and testing. However, it is important to note that while it is a great tool for local development, it has its limitations especially when simulating a production-level multinode Kubernetes cluster. One of the major limitations of Minikube is that the local cluster can only consist of one node. As a result, it may not be the best tool for testing or simulating more complex Kubernetes clusters with multiple nodes, which are closer to the production environment.
Also, no matter how beefy your local machine is, you’re going to run out of resources once you have a few dozen services running together.
Finally, when working with a large number of developers, local replication is always going to be limited: it becomes very difficult to keep up with the state of multiple services that other developers are updating.
For production-like environments with dozens or hundreds of other developers, you’ll want a sandboxing tool like Signadot in your staging environment to let you work with a modified version of your service, by dynamically routing requests to it.
You can get started with Signadot in just a few minutes, and be ready to test changes on your services in a real-word environment.
Join our 1000+ subscribers for the latest updates from Signadot